creazioni siti web rovigo

Unity 3D Game Engine – Stealth Game – Single Doors – JS

Unity 3D Game Engine – Stealth Game – Single Doors – JS

Load prefab:
-> (parent) ‘door_generic_slide’
|Animator – Closed animation, Open animation inside are inside fbx file
|SingleDoorAnimator – uncheck Apply Root Motion – parameter bool: open – transitions: open->close close->open
|Sphere Collider – check ‘Is Trigger’ (to check player position)
|Audio Source Component (doorSwishClip + accessDeniedClip), uncheck ‘Play on Awake’
|DoorAnimation.js

–> (child) ‘door_generic_slide_panel’
|Mesh Renderer, check ‘Use Light Probes’
|Box Collider (to block the player penetration)
|Rigid Body, uncheck ‘Use Gravity’, check ‘Is Kinematic’ (to block the player penetration)

DoorAnimation.js:


#pragma strict

public var requireKey : boolean;                    // Whether or not a key is required.
public var doorSwishClip : AudioClip;               // Clip to play when the doors open or close.
public var accessDeniedClip : AudioClip;            // Clip to play when the player doesn't have the key for the door.


private var anim : Animator;                        // Reference to the animator component.
private var hash : HashIDs;                         // Reference to the HashIDs script.
private var player : GameObject;                    // Reference to the player GameObject.
private var playerInventory : PlayerInventory;      // Reference to the PlayerInventory script.
private var count : int;                            // The number of colliders present that should open the doors.


function Awake ()
{
    // Setting up the references.
    anim = GetComponent(Animator);
    hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent(HashIDs);
    player = GameObject.FindGameObjectWithTag(Tags.player);
    playerInventory = player.GetComponent(PlayerInventory);
}


function OnTriggerEnter (other : Collider)
{
    // If the triggering gameobject is the player...
    if(other.gameObject == player)
    {
        // ... if this door requires a key...
        if(requireKey)
        {
            // ... if the player has the key...
            if(playerInventory.hasKey)
                // ... increase the count of triggering objects.
                count++;
            else
            {
                // If the player doesn't have the key play the access denied audio clip.
                audio.clip = accessDeniedClip;
                audio.Play();
            }
        }
        else
            // If the door doesn't require a key, increase the count of triggering objects.
            count++;
    }
    // If the triggering gameobject is an enemy...
    else if(other.gameObject.tag == Tags.enemy)
    {
        // ... if the triggering collider is a capsule collider...
        if(typeof(other) == CapsuleCollider)
            // ... increase the count of triggering objects.
            count++;
    }
}


function OnTriggerExit (other : Collider)
{
    // If the leaving gameobject is the player or an enemy and the collider is a capsule collider...
    if(other.gameObject == player || (other.gameObject.tag == Tags.enemy && typeof(other) == CapsuleCollider))
        // decrease the count of triggering objects.
        count = Mathf.Max(0, count-1);
}


function Update ()
{
    // Set the open parameter.
    anim.SetBool(hash.openBool,count > 0);
    
    // If the door is opening or closing...
    if(anim.IsInTransition(0) && !audio.isPlaying)
    {
        // ... play the door swish audio clip.
        audio.clip = doorSwishClip;
        audio.Play();
    }
}

Inspector> DRAG AND DROP> variables:
– Door Swish Clip (Audio Clip)
– Access Denied Clip (Audio Clip)
– uncheck ‘Require Key’, you will open this door without a key

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D Game Engine – Stealth Game – Single Doors – JS

Unity 3D – Stealth Game – HashIDs

Unity 3D – Stealth Game – HashIDs

Here we store the hash tags for various strings used in our animators.

1. Hierarchy> ‘gameController’


#pragma strict

// Here we store the hash tags for various strings used in our animators.
public var dyingState : int;
public var locomotionState : int;
public var shoutState : int;
public var deadBool : int;
public var speedFloat : int;
public var sneakingBool : int;
public var shoutingBool : int;
public var playerInSightBool : int;
public var shotFloat : int;
public var aimWeightFloat : int;
public var angularSpeedFloat : int;
public var openBool : int;


function Awake ()
{
    dyingState = Animator.StringToHash("Base Layer.Dying");
    locomotionState = Animator.StringToHash("Base Layer.Locomotion");
    shoutState = Animator.StringToHash("Shouting.Shout");
    deadBool = Animator.StringToHash("Dead");
    speedFloat = Animator.StringToHash("Speed");
    sneakingBool = Animator.StringToHash("Sneaking");
    shoutingBool = Animator.StringToHash("Shouting");
    playerInSightBool = Animator.StringToHash("PlayerInSight");
    shotFloat = Animator.StringToHash("Shot");
    aimWeightFloat = Animator.StringToHash("AimWeight");
    angularSpeedFloat = Animator.StringToHash("AngularSpeed");
    openBool = Animator.StringToHash("Open");
}

By |Unity3D, Video Games Development|Commenti disabilitati su Unity 3D – Stealth Game – HashIDs

Unity – Folders organization

Unity – Folders organization

Default Unity install path

C:\Programmi\Unity\

Asset Store

C:\Utenti\YouUserName\AppData\Roaming\Unity\Asset Store\PublisherName

\Particle Systems
\3D ModelsEnvironmentsLandscapes
\Complete ProjectsTemplates

Format sample: Cartoon FX Pack.unitypackage

By |Unity3D, Video Games Development|Commenti disabilitati su Unity – Folders organization

MySQL Quick Reference – NULL

NULL Values

NULL values represent missing unknown data.
By default, a table column can hold NULL values.
It is not possible to compare NULL and 0; they are not equivalent.

To select NULL Values:

SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NULL

MySQL does have an ISNULL() function. However, it works a little bit different from Microsoft’s ISNULL() function.
In MySQL we can use the IFNULL() function, like this:

SELECT ProductName,UnitPrice*(UnitsInStock+IFNULL(UnitsOnOrder,0))
FROM Products

OR

SELECT ProductName,UnitPrice*(UnitsInStock+COALESCE(UnitsOnOrder,0))
FROM Products

To select only the records with no NULL values:

SELECT LastName,FirstName,Address FROM Persons
WHERE Address IS NOT NULL
By |MySQL, Web Design|Commenti disabilitati su MySQL Quick Reference – NULL

WordPress – Eliminare l’avvertimento di aggiornamento

WordPress – Eliminare l’avvertimento di aggiornamento

Se l’amministrazione di WordPress è usata maggiormente da un nostro cliente, può risultare utile nascondere l’avviso di aggiornamento a nuove versioni di WP.

Aprire blog/wp-content/themes/mytheme/functions.php

Aggiungere le righe in testa:

// Remove Admin Menu Update Avaiable START
add_action('admin_menu','wphidenag');
function wphidenag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
// Remove Admin Menu Update Avaiable END
By |Web Design, WordPress|Commenti disabilitati su WordPress – Eliminare l’avvertimento di aggiornamento