Пример #1
0
    // main logic
    public override void Init()
    {
        base.Init();

        // init player and data managers
        if (myPlayerManager_New == null)
        {
            myPlayerManager_New = (PlayerManager_Tank)myPlayerManager;

            if (myPlayerManager_New)
            {
                myDataManager_New = (UserManager_Tank)myDataManager;
            }
        }

        myDataManager_New.SetDetaleHealth(thisEnemyDetaleStrange);
        myDataManager_New.SetProtection(thisEnemyProtection);

        // lets find our ai controller
        BaseAIController aControl = (BaseAIController)gameObject.GetComponent <BaseAIController> ();

        // and tell it to chase our player around the screen (we get the player transform from game controller)
        aControl.SetChaseTarget(GameController_Tank.Instance.GetMainPlayerTransform());

        // now get on and chase it!
        aControl.SetAIState(AIStates.AIState.chasing_target);

        // we also need to add this enemy to the radar, so we will tell game controller about it and
        // some code in game controller will do this for us
        GameController_Tank.Instance.AddEnemyToRadar(myTransform);
    }
Пример #2
0
    // main logic
    public override void Init()
    {
        base.Init();

        // do god mode, if needed)
        if (!godMode)
        {
            MakeVulnerable();
        }
        else
        {
            MakeInvulnerable();
        }

        // start out with no control from the player
        canControl = false;

        // get a ref to the weapon controller
        weaponControl = myGO.GetComponent <Standard_SlotWeaponController> ();

        // if a player manager is not set in the editor, let's try to find one
        if (myPlayerManager == null)
        {
            myPlayerManager = myGO.GetComponent <PlayerManager_Tank> ();
        }

        // set up the data for our player
        myDataManager = myPlayerManager.DataManager_Tank;
        myDataManager.SetName("Player");
        myDataManager.SetHealth(3);
        myDataManager.SetDetaleHealth(100);
        myDataManager.SetProtection(0.5f);

        isFinished = false;

        // get a ref to the player manager
        GameController_Tank.Instance.UpdateLivesP1(myDataManager.GetHealth());
        GameController_Tank.Instance.UpdateLivesDetaleP1(myDataManager.GetDetaleHealth());
    }
Пример #3
0
    void Respawn()
    {
        // reset the 'we are respawning' variable
        isRespawning = false;

        // we need to be invulnerable for a little while
        MakeInvulnerable();

        Invoke("MakeVulnerable", 3);

        //set detale helth
        myDataManager.SetDetaleHealth(100);
        GameController_Tank.Instance.UpdateLivesDetaleP1(myDataManager.GetDetaleHealth());

        // show ship body again
        theMeshGO.SetActive(true);

        // revert to the first weapon
        weaponControl.SetWeaponSlot(0);

        // show the current weapon (since it was hidden when the ship explosion was shown)
        weaponControl.EnableCurrentWeapon();
    }