public CDistroyer() { Type = EUnitType.Distroyer; Speed = 40; myBehavior = new CSeaBehavior(); myWeapon = new CCannon(); }
protected int m_nIdx = 0; //< This cannon index in the cannon list /* ----------------------------------------------------------------------------------------------------------- * UNITY'S STUFF HERE * ----------------------------------------------------------------------------------------------------------- */ /// <summary> /// Will execute when loaded /// </summary> void Awake() { Script = this; // Get the main script mainScript = GameObject.Find("/GameCode").GetComponent<ShooterControl>(); if(!mainScript) { // DEBUG Debug.LogError(this.transform + " could get the ShooterControl from Code"); } RegisterMyselfWithMainScript(); }
/// <summary> /// Add a cannon to the cannon list /// </summary> /// <param name="tr"> The transform for the new cannon </param> public void RegisterCannon(Transform tr, CCannon script) { int nCount = lCannons.Count; lCannons.Add(tr); lCannonsScripts.Add(script); script.nIdx = nCount; // FIXME: hack to make the player control a cannon if (nPlayerCannonIdx < 0) { PlayerControlCannon(trPlayer, nCount); } }