GUIControl.addMonkey C# (CSharp) Method

addMonkey() public method

public addMonkey ( CMonkey newMonkey ) : void
newMonkey CMonkey
return void
    public void addMonkey(CMonkey newMonkey)
    {
        if (allMonkeys == null)
            allMonkeys = new ArrayList();
        allMonkeys.Add(newMonkey);
        if (boxYposition == null)
            boxYposition = new ArrayList();
        boxYposition.Add(642);
        if (yDirection == null)
            yDirection = new ArrayList();
        yDirection.Add(0);
    }

Usage Example

Example #1
0
    /*
     * ===========================================================================================================
     * UNITY'S STUFF
     * ===========================================================================================================
     */
    /// <summary>
    /// When the script is initialized
    /// </summary>
    void Awake()
    {
        // Set the default settings for all the buildings
        Selectable = true; // All monkeys are selectable
        Movable = true; // All monkeys are movable
        Type = eObjType.Monkey;
        AIScript = gameObject.GetComponent<AstarAIFollow>();

        // FSM setup
        eFSMCurrentState = FSMState.STATE_NULL;

        // Get info about the collider
        GetColliderInfo();

        // Load the icon for this unit
        LoadMinimapIcon();

        // Starts the object variables, like the sweet spot and the main mesh object
        GetSweetSpotAndMeshObject();

        // Get the capture spot
        if(monkeyClass == eMonkeyType.Cientist) {

            captureSpot = GetCaptureSpot();
            captureRaySpot = GetCaptureRaySpot();

        }

        // Get's the spot where we will test for collisions used in the attack
        attackSpot = GetAttackSpot();

        GUIScript = GameObject.Find("HUD-Objects").GetComponent<GUIControl>();
        GUIScript.addMonkey(this);

        fTimeToStartMonkey = Random.value * 10;

        if(meshObject) {

            // Calculates the walk cycle half length
            fDustTimeOfAStep = meshObject.animation[stAnimWalk].clip.length / 2;

            // DEBUG
            //Debug.Log(this.transform + " Length: " + fDustTimeOfAStep);
        }
    }