示例#1
0
    void Start()
    {
        objCamera = (tk2dCamera)GameObject.FindWithTag("MainCamera").GetComponent <tk2dCamera>();

        objPlayer         = (GameObject)GameObject.FindWithTag("Player");
        objScriptVariable = (VariableScript)objPlayer.GetComponent(typeof(VariableScript));
        objSprite         = GetComponent <tk2dSprite>();

        objBarrel     = GameObjectUtilts.FindChild(gameObject.name, "Barrel");
        missileOrigin = objBarrel.transform.Find("BulletOrigin");

        health = maxHealth;
    }
    void Start()
    {
        //Debug.Log("MinigunController:Start(" + gameObject.name + ")");

        start  = Time.time;
        health = maxHealth;

        objSprite = GetComponent <tk2dSprite>();

        // Get child barrel object which is what rotates and fires projectiles
        objBarrel = GameObjectUtilts.FindChild(gameObject.name, "Barrel");

        //TODO I think the bullet origin should be stored as a Transform array so
        // more it does not have to be hard coded.

        // Get the origin for projectiles on the barrel object.
        // This is where projectiles shot from this gun will originate.
        barrelOrigin0 = objBarrel.transform.Find("BarrelOrigin0");
        barrelOrigin1 = objBarrel.transform.Find("BarrelOrigin1");

        // Only track objects on this layer.
        trackingLayer = LayerMask.NameToLayer("Enemies");
    }