Example #1
0
    public virtual void Awake()
    {
        _shipState = GetComponent <ShipStateBehaviour>();

        var weaponsToAdd  = GetComponents <ShipWeapon>();
        var defensesToAdd = GetComponents <ShipDefense>();

        for (var x = 0; x < weaponsToAdd.Length; x++)
        {
            shipWeapons.Add(weaponsToAdd[x]);
        }

        while (shipWeapons.Count < 3)
        {
            var x = gameObject.AddComponent(typeof(EmptyWeaponSlot)) as EmptyWeaponSlot;
            shipWeapons.Add(x);
        }

        for (var x = 0; x < defensesToAdd.Length; x++)
        {
            shipDefenses.Add(defensesToAdd[x]);
        }

        while (shipDefenses.Count < 2)
        {
            var x = gameObject.AddComponent(typeof(EmptyDefenseSlot)) as EmptyDefenseSlot;
            shipDefenses.Add(x);
        }

        shipDefenses[1].direction = "right";
    }
Example #2
0
    public float validJumpDistance = 50f;     //How far from system center to be able to do a hyperspace jump


    void Awake()
    {
        playerObject = GameObject.FindWithTag("PlayerObject");
        playerShip   = playerObject.transform.GetChild(0).gameObject;
        shipState    = playerShip.GetComponent <ShipStateBehaviour>();

        _cameraBehaviour = Camera.main.GetComponent <CameraBehaviour>();


        if (playerShip.GetComponent <ShipChassis>())
        {
            shipChassis = playerShip.GetComponent <ShipChassis>();
            playerShip.GetComponent <ShipData>()._guiManager =
                GameObject.FindGameObjectWithTag("GameController").GetComponent <GUIManager>();
            //Debug.Log("Got player chassis");
        }
        else
        {
            Debug.Log("No chassis found.");
        }
    }
Example #3
0
 void Awake()
 {
     defenseName = "Roll Module : " + direction;
     shipState   = GetComponent <ShipStateBehaviour>();
     audioSource = GetComponent <AudioSource>();
 }