Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        playerAnimation = GetComponent <playerAnimation>();
        playerMovement  = GetComponent <playerMovement>();

        playerAnim = GetComponent <Animator>();

        health = maxHealth;
    }
 private void Update()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         audioSource.PlayOneShot(audioManager.playerShot, 2f);
         if (Physics.Raycast(Camera.transform.position, Camera.transform.forward, out RaycastHit hit, 30.0f) && hit.transform.CompareTag("Enemy"))
         {
             PlayerAnimation         = hit.transform.gameObject.GetComponent <playerAnimation>();
             PlayerAnimation.health -= 50;
         }
     }
 }
Example #3
0
    void Start()
    {
        // Set external scripts.
        playerAnimationScript = transform.GetComponent <playerAnimation>();
        playerCombatScript    = transform.GetComponent <playerCombat>();
        playerMovementScript  = transform.GetComponent <playerMovement>();
        levelManagerScript    = GameObject.FindGameObjectWithTag("LevelManager").GetComponent <LevelManager>();

        if (!enemy)
        {
            print("WARNING: You must set one enemy (the PC character) for this script in the Inspector View!");
        }
    }
    void Awake()
    {
        _instance = this;

        ps        = this.GetComponent <playerstatus>();
        animation = GetComponent <Animation> ();
        normal    = body.GetComponent <Renderer> ().material.color;
        pa        = this.GetComponent <playerAnimation> ();
        foreach (GameObject go in efxArray)
        {
            efxDict.Add(go.name, go);
        }
    }
Example #5
0
        public static StanceAnimation GetAnimation(playerAnimation a)
        {
            StanceAnimation an;

            switch (a)
            {
            case playerAnimation.Idle:
                an = new StanceAnimation((int)playerAnimation.Idle);
                an.AddStance(StaticStanceplayer.Get(playerStance.Idle), 35, 0);
                an.AddStance(StaticStanceplayer.Get(playerStance.Idle1), 100, 0);
                an.AddStance(StaticStanceplayer.Get(playerStance.Idle), 35, 0);
                return(an);

            case playerAnimation.Answer:
                an = new StanceAnimation((int)playerAnimation.Answer);
                an.AddStance(StaticStanceplayer.Get(playerStance.Answer), 5, 0);
                return(an);

            default:
                return(null);
            }
        }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
        playerAnimation = GetComponent <playerAnimation>();

        playerRB = GetComponent <Rigidbody2D>();
    }
Example #7
0
 void Start()
 {
     _rigidBody = GetComponent <Rigidbody2D>();
     _anim      = GetComponent <playerAnimation>();
     _renderer  = GetComponentInChildren <SpriteRenderer>();
 }