Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        playerStaminaMan = FindObjectOfType <PlayerStaminaManager>();

        thePlayer = FindObjectOfType <PlayerController>();

        sfxMan = FindObjectOfType <SFXManager>();

        shield = FindObjectOfType <ShieldBlock>();

        thePS = FindObjectOfType <PlayerStats>();

        enemy = FindObjectOfType <EnemyTestScript>();

        playerHealth = FindObjectOfType <PlayerHealthManager>();
        hurtEnemy    = FindObjectOfType <HurtEnemy>();

        enemyHealth = FindObjectOfType <EnemyHealthManager>();

        playerEngagement = FindObjectOfType <EngagedWithPlayer>();

        // enemyStaminaMan = FindObjectOfType<EnemyStaminaManager>();

        deathStrike = false;

        showBlood          = false;
        playerStaminaDrain = false;
    }
    // Use this for initialization
    void Start()
    {
        thePlayer = FindObjectOfType <PlayerController>();

        theDM = FindObjectOfType <DialogueManager>();

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

        engageWithPlayerObject = this.gameObject.transform.GetChild(0).gameObject;
        playerEngagement       = engageWithPlayerObject.GetComponent <EngagedWithPlayer>();

        enemyGameObject = this.gameObject;
        enemyTransform  = enemyGameObject.transform;


        walkCounter = Random.Range(walkTime * 0.75f, walkTime * 1.25f);
        waitCounter = Random.Range(waitTime * 0.75f, walkTime * 1.25f);

        ChooseDirection();

        if (walkZone != null)
        {
            minWalkPoint = walkZone.bounds.min;
            maxWalkPoint = walkZone.bounds.max;
            hasWalkZone  = true;
        }

        canMove   = true;
        isWalking = true;
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     playerStamina    = FindObjectOfType <PlayerStaminaManager>();
     hurtPlayer       = FindObjectOfType <HurtPlayerUpdated>();
     sfxMan           = FindObjectOfType <SFXManager>();
     playerEngagement = FindObjectOfType <EngagedWithPlayer>();
     playerShield     = FindObjectOfType <ShieldBlock>();
     counter          = 0;
 }
Ejemplo n.º 4
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()
 {
     playerEngagement  = FindObjectOfType <EngagedWithPlayer>();
     thePlayer         = FindObjectOfType <PlayerController>();
     playerObject      = GameObject.Find("Player");
     playerShield      = thePlayer.GetComponentInChildren <ShieldBlock>();
     thisKnife         = this.gameObject;
     sfxMan            = FindObjectOfType <SFXManager>();
     rangedDeathStrike = 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;
    }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     playerEngagement = FindObjectOfType <EngagedWithPlayer>();
     playerObject     = GameObject.Find("Player");
     enemyObject      = this.gameObject;
     rangedEnemy      = enemyObject.GetComponent <BasicRangedEnemy>();
     rotatingObject   = this.gameObject.transform.GetChild(8).gameObject;
     throwForce       = 255;
     inRange          = false;
     lineOfSight      = true;
     pathfinder       = FindObjectOfType <Pathfinding>();
     pathfinderTimer  = 0;
     enqueue          = false;
     attackRange      = 8;
 }
Ejemplo n.º 8
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        try
        {
            playerEngagement = other.gameObject.transform.GetChild(0).GetComponent <EngagedWithPlayer>();
        }
        catch
        {
            return;
        }
        theEnemy = other.gameObject.GetComponent <EnemyTestScript>();

        // FreezeFrame();

        if (other.gameObject.tag == "Enemy" && playerEngagement.thePlayerDeathStrike || other.gameObject.tag == "LargeEnemyBasic" && playerEngagement.thePlayerDeathStrike || other.gameObject.tag == "BasicRangedEnemy" && playerEngagement.thePlayerDeathStrike ||
            other.gameObject.tag == "Enemy1")
        {
            enemyHit = true;
            // staminaManager.playerCurrentStamina += 20;

            // Animator anim2 = other.gameObject.GetComponent<Animator>();
            // if (thePlayer.recovAttack)
            // {
            //     anim2.enabled = false;
            // }
            // else
            // {
            //     anim2.enabled = true;
            // }

            if (playerEngagement.attacking && thePlayer.damagePossible &&
                playerEngagement.faceOff)
            {
                playerEngagement.strikeBlock  = true;
                sfxMan.swordsColliding.volume = 1;
                sfxMan.swordsColliding.Play();
                Instantiate(swordClash, swordClashPoint.position, swordClashPoint.rotation);
            }
            //was else if
            if (!thePlayer.noDamageIsTaken && !playerEngagement.attacking)
            {
                if (thePlayer.wasSprint && staminaManager.playerCurrentStamina > 50 && playerStats.dexterity >= 14 && playerStats.strength >= 9)
                {
                    if (playerStats.strength == 11)
                    {
                        currentDamage = damageToGive + thePS.currentAttack + 2;
                    }
                    else
                    {
                        currentDamage = damageToGive + thePS.currentAttack + 1;
                    }
                    // currentDamage = damageToGive + thePS.currentAttack + 1;
                    // Debug.Log(currentDamage);
                }
                else
                {
                    if (playerStats.strength == 11)
                    {
                        currentDamage = damageToGive + thePS.currentAttack + 1;
                    }
                    else
                    {
                        currentDamage = damageToGive + thePS.currentAttack;
                    }
                }
                sfxMan.blood.Play();
                if (this.gameObject.tag == "Throwing Knife")
                {
                    other.gameObject.GetComponent <EnemyHealthManager>().HurtEnemy(2);
                    Instantiate(damageBurst, hitPoint.position, hitPoint.rotation);
                    var clone = (GameObject)Instantiate(damageNumber, hitPoint.position,
                                                        Quaternion.Euler(Vector3.zero));
                    clone.GetComponent <FloatingNumbers>().damageNumber = currentDamage;
                }
                else
                {
                    other.gameObject.GetComponent <EnemyHealthManager>().HurtEnemy(currentDamage);
                    Instantiate(damageBurst, hitPoint.position, hitPoint.rotation);
                    var clone = (GameObject)Instantiate(damageNumber, hitPoint.position,
                                                        Quaternion.Euler(Vector3.zero));
                    clone.GetComponent <FloatingNumbers>().damageNumber = currentDamage;
                }
            }
        }
        else if (other.gameObject.tag == "Enemy" && other.gameObject.GetComponent <EnemyTestScript>().enemyShield&& !thePlayer.deathStrike ||
                 other.gameObject.tag == "LargeEnemyBasic" && other.gameObject.GetComponent <EnemyTestScript>().enemyShield&& !thePlayer.deathStrike)//
        {
            //enemyShieldStrike = true;
            other.gameObject.GetComponent <EnemyTestScript>().enemyShieldStrike = true;
            sfxMan.swordsColliding.volume = 1;
            sfxMan.swordsColliding.Play();
            // theEnemy= new Vector2(2,2);
            theEnemy.blockCounter++;
            // other.GetComponentInParent<Rigidbody2D>().rigidbody2D -= new Vector2(2,2);
            Instantiate(swordClash, swordClashPoint.position, swordClashPoint.rotation);
        }
    }