示例#1
0
 // Use this for initialization
 void Start()
 {
     movementModule = GetComponent<MovementModule>();
     trackingModule = GetComponent<TrackingModule>();
     loadoutModule = GetComponent<AircraftLoadout>();
     fireControlModule = GetComponent<AircraftFireControl>();
 }
    // Use this for initialization
    void Awake()
    {
        loadout = gameObject.GetComponent<AircraftLoadout>();
        coneManager = GameObject.Find("ConeManager").GetComponent<GenerateCone>();

        PlayerPlaneSelectionHandler.OnSelectedPlaneChanged += delegate(GameObject newSelectedPlane) {
            if(newSelectedPlane == this.gameObject){
                ChangeSelectedWeapon(-1);
            }
        };
    }
    private void DisplayWeapons(AircraftLoadout loadout)
    {
        ActivateWeaponButtons(false);
        ClearWeaponImages();

        for (int i = 0; i < loadout.loadedArmament.Length; i++) {
            //TODO add sprites for other weapons as well
            GameObject weapon = loadout.loadedArmament[i];
            if(weapon.GetComponent<MissileCore>() != null){

                SetImageForButton(i+1,missile);
                weaponButtons[i+1].interactable = true;
            } else {
                SetImageForButton(i+1, null);
            }
        }
    }