Exemplo n.º 1
0
    // main logic
    public override void Init()
    {
        base.Init();

        didInit = false;

        if (weaponControl == null)
        {
            // try to find weapon controller on this gameobject
            weaponControl = myGO.GetComponent <Standard_SlotWeaponController> ();
        }

        if (rendererToTestAgainst == null)
        {
            // we need a renderer to find out whether or not we are on-screen
            rendererToTestAgainst = myGO.GetComponentInChildren <Renderer> ();
        }

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

        myDataManager = myPlayerManager.GetDataManager();
        myDataManager.SetName("Enemy");
        myDataManager.SetHealth(thisEnemyStrength);

        canFire = true;
        didInit = true;
    }
Exemplo n.º 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;

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

        // set up the data for our player
        myDataManager = myPlayerManager.GetDataManager();
        myDataManager.SetName("Player1");
        myDataManager.SetHealth(3);

        isFinished = false;

        // get a ref to the player manager
        GameController_Plt2D.Instance.UpdateLivesP1(myDataManager.GetHealth());
    }