private float enemyScale;         // Sets the default scale of the enemy to make sure that all enemies are the same size.

    void Start()
    {
        UpdateDistFromPlayer();                                                     // Grab initial player distance reference.
        player         = GameObject.Find("Player").GetComponent <PlayerFighting>(); // Target player health/damage object.
        score          = GameObject.Find("ScoreUI").GetComponent <CountScore>();    // Target the gameobject handled within the CountScore script.
        animator       = gameObject.GetComponent <Animator>();                      // Get reference of the enemy animator.
        playerLocation = GameObject.Find("Player").transform;
        // Set initial values of enemy variants:
        if (gameObject.name == "Boss")
        {
            health     = 1000f;
            enemyScale = 0.1f;                  // Make the boss scale larger than regular enemies.
            damage     = 20f;                   // Boss deals higher damage than regular enemies.
        }
        else if (gameObject.name == "Miniboss") // Set miniboss to intermediate stage of damage, health etc. (between regular enemy and boss).
        {
            health     = 250f;
            enemyScale = 0.09f;
        }
        else
        {
            health     = 100f;
            enemyScale = 0.07f;
        }
    }
Example #2
0
 void Start()
 {
     stats          = PlayerManager.instance.player.GetComponent <CharacterStats>();
     slider         = healthUiParent.GetComponentInChildren <Slider>();
     Text           = healthUiParent.GetComponentInChildren <TextMeshProUGUI>();
     playerFighting = PlayerManager.instance.player.GetComponent <PlayerFighting>();
     playerFighting.OnWeaponChange += UpdateWeaponsSlot;
     slotsImages = weaponSlotsParent.GetComponentsInChildren <Image>();
 }
    public override void Interact()
    {
        PlayerFighting playerFighting = player.GetComponent <PlayerFighting>();

        playerFighting.EquipWeapon(weapon, 1);


        Destroy(gameObject);
    }
 void Start()
 {
     camera = GameObject.FindGameObjectWithTag("CameraObject");
     lastCameraTransform = camera;
     //animator = GetComponent<Animator> ();
     controller = GetComponent <CharacterController> ();
     lastDesiredFacingRotation = Quaternion.Euler(0, 45, 0);
     playerFighting            = GetComponent <PlayerFighting>();
 }
Example #5
0
    // Use this for initialization
    void Start()
    {
        colliderplayer = GetComponent <CapsuleCollider2D>();
        animator       = GetComponent <Animator>();
        playerCombat   = GetComponent <PlayerFighting>();
        stats          = GetComponent <CharacterStats>();
        movementSpeed  = stats.GetMovementSpeed;


        filter.useTriggers = false;
        filter.SetLayerMask(Physics2D.GetLayerCollisionMask(gameObject.layer));
        filter.useLayerMask = true;
    }
Example #6
0
        //means that our player object picked up our item
        public override GameObject PickUp(GameObject player)
        {
            PlayerFighting playerFighting = player.GetComponent <PlayerFighting> ();

            if (playerFighting != null)
            {
                BowWeapon bow = playerFighting.GetLeftHandWeapon().GetComponent <BowWeapon>();
                if (bow != null)
                {
                    bow.stockpile += arrowCount;
                    GameObject.Destroy(this.gameObject);
                }
            }

            //we don't want to return anything here
            return(null);
        }
 void Start()
 {
     camera = GameObject.FindGameObjectWithTag("CameraObject");
     lastCameraTransform = camera;
     //animator = GetComponent<Animator> ();
     controller = GetComponent<CharacterController> ();
     lastDesiredFacingRotation = Quaternion.Euler (0, 45, 0);
     playerFighting = GetComponent<PlayerFighting>();
 }
Example #8
0
    public IEnumerator DamageAndKnockBackOffsetTimer(PlayerFighting pFight, float amount, Vector3 direction, float knockbackMultiplayer)
    {
        yield return(new WaitForSeconds(.085f));

        pFight.TakeHit(amount, direction, knockbackMultiplayer);
    }
Example #9
0
    private PlayerFighting player; // Target the player object.

    void Start()
    {
        player = GameObject.Find("Player").GetComponent <PlayerFighting>(); // Get the player reference.
    }