예제 #1
0
    // Use this for initialization
    void Start()
    {
        this.gameObject.name   = "Thomas";
        enemyObject            = this.gameObject;
        engageWithPlayerObject = this.gameObject.transform.GetChild(0).gameObject;
        enemyHealthMan         = enemyObject.GetComponent <EnemyHealthManager>();
        // enemyStaminaMan = enemyObject.GetComponent<EnemyStaminaManager>();
        playerEngagement = engageWithPlayerObject.GetComponent <EngagedWithPlayer>();
        stalkZoneObject  = this.gameObject.transform.GetChild(7).gameObject;
        stalkZone        = stalkZoneObject.GetComponent <RecognizeStalkZone>();

        rangedAttack = enemyObject.GetComponent <EnemyRangedAttack>();

        playerHealthMan  = FindObjectOfType <PlayerHealthManager>();
        playerStaminaMan = FindObjectOfType <PlayerStaminaManager>();

        playerHealth = FindObjectOfType <PlayerHealthManager>();

        hurtPlayer = FindObjectOfType <HurtPlayerUpdated>();
        randomMove = FindObjectOfType <RandomMovement>();

        //this needs to grab child object script
        //playerEngagement = FindObjectOfType<EngagedWithPlayer>();

        playerObject = GameObject.Find("Player");
        thePlayer    = playerObject.GetComponent <PlayerController>();
        target       = playerObject;

        dodgeCounter = 2.2f;

        tellCounter = 0.5f;
        actionTimer = 0.2f;

        enemyHurtCounter = 2;

        myRigidbody = GetComponent <Rigidbody2D>();
        anim        = GetComponent <Animator>();

        if (!enemyExists)
        {
            enemyExists = true;
            //DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            //Destroy(gameObject);
        }

        // dodging = true;
        // dodgeFirstTime = true;

        //For now enemy will always have a correct line of sight and the fleeing system is not yet set up.
        fleeTwo      = false;
        dodgingThree = false;

        followToDeath = false;
    }
    // Use this for initialization
    void Start()
    {
        this.gameObject.name   = "Fred";
        enemyObject            = this.gameObject;
        engageWithPlayerObject = this.gameObject.transform.GetChild(0).gameObject;
        enemyHealthMan         = enemyObject.GetComponent <EnemyHealthManager>();
        // enemyStaminaMan = enemyObject.GetComponent<EnemyStaminaManager>();
        playerEngagement = engageWithPlayerObject.GetComponent <EngagedWithPlayer>();
        stalkZoneObject  = this.gameObject.transform.GetChild(7).gameObject;
        stalkZone        = stalkZoneObject.GetComponent <RecognizeStalkZone>();

        raycastPath = enemyObject.GetComponent <TrackingRaycast>();

        playerHealthMan  = FindObjectOfType <PlayerHealthManager>();
        playerStaminaMan = FindObjectOfType <PlayerStaminaManager>();

        playerHealth = FindObjectOfType <PlayerHealthManager>();

        hurtPlayer = FindObjectOfType <HurtPlayerUpdated>();

        playerObject = GameObject.Find("Player");
        thePlayer    = playerObject.GetComponent <PlayerController>();
        target       = playerObject;

        enemyShieldStrike          = false;
        shieldBreakRecoveryCounter = 0.5f;

        dodgeCounter = 2.2f;

        tellCounter = 0.5f;
        actionTimer = 0.2f;

        enemyHurtCounter = 2;

        myRigidbody = GetComponent <Rigidbody2D>();
        anim        = GetComponent <Animator>();

        if (!enemyExists)
        {
            enemyExists = true;
        }

        dodging        = true;
        dodgeFirstTime = true;

        isPathfinding   = false;
        retreatingThree = false;
        shieldUpTwo     = false;

        followToDeath = false;

        blockCounterMax   = UnityEngine.Random.Range(2, 4);
        blockCounterTimer = 1.5f;
    }