Start() public method

public Start ( ) : void
return void
Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //Attack with melee weapon if within melee range and shield is not active
        if (aIController.GetDistanceToPlayer() <= MeleeRange && !Shield.Active)
        {
            MeleeWeapon.RandomAttack();
        }
        //else if the within melee rance and staff range and is past the second stage use staff
        else if (aIController.GetDistanceToPlayer() >= MeleeRange && aIController.GetDistanceToPlayer() <= StaffRange && currentStage >= 1)
        {
            //randomly use staff if shield is not active
            if (Random.value > .8f && !Shield.Active)
            {
                StaffWeapon.Attack(playerTransform); //attack with staff and pass player Transform so the projectiles follow the player
            }
        }

        //if stage 3 is active then use the shield
        if (currentStage >= 2)
        {
            Shield.Use();
        }
        if (Shield.Active || currentlyCharging) // if shield is active stop movement
        {
            aIController.Stop();
        }
        else
        {
            aIController.Start();
        }

        //if on stage 4 charge
        if (currentStage >= 3 && !chargeCooldown)
        {
            StartCoroutine(Charge(transform, transform.position, playerTransform.position, 50f));
        }

        // check if health is less than 0 and current stage is less than the amount of stages
        if (characterData.CurrentHealth <= 0.0f && currentStage < HealthStages.Length)
        {
            //enter next stage
            currentStage++;

            //alert the plater of next stage
            AlertManager.GetInstance().AddAlert("Stage " + (currentStage + 1) + " about to start!");
            //set the bosses health to next stage and heal him
            characterData.SetMaxHealth(HealthStages[currentStage]);
            characterData.Heal(HealthStages[currentStage]);
        }
        else if (characterData.CurrentHealth <= 0.0f && currentStage >= HealthStages.Length)
        {
            //if the boss dies and it and is on the last stage kill the boss
            characterData.Kill();
        }
    }
Ejemplo n.º 2
0
    void CreatTestAI(int nums)
    {
        for (int i = 0; i < nums; i++)
        {
            AIController ai = new AIController();
            //ai set gameobj and model
            Debug.Log("GetModel ");
            GameObject go = Resources.Load <GameObject>("FSM/" + "TEnemy");
            ai.role = Instantiate(go);
            ai.role.transform.position = new Vector3(CreatPOSCenter.transform.position.x + Random.Range(-10, 30), 1, CreatPOSCenter.transform.position.z + Random.Range(-10, 30));
            Debug.Log("CreatModelSuccess ");
            ai.aIGameManger = this;
            ai.Start();
            aIControllers.Add(ai);
        }

        //Debug.Log("aIControllers CreatCount - " + aIControllers.Count);
    }