Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SoldierAnim : MonoBehaviour
- {
- public Animator anim;
- public bool lookY;
- public bool lookX;
- public float ang;
- public Vector2 bjV;
- public Vector2 soldierV;
- public Soldier s;
- public Transform bj;
- public FOV field;
- public Transform soldier;
- public Vector3 mov;
- public Bullet b;
- // Start is called before the first frame update
- void Start()
- {
- anim = GetComponent<Animator>();
- ang = 0.0f;
- }
- // Update is called once per frame
- void Update()
- {
- anim.SetFloat("X", s.dirX);
- anim.SetFloat("Y", s.dirY);
- anim.SetBool("Dead", s.dead);
- if(s.attack == true)
- {
- anim.SetTrigger("Attack");
- }
- if(field.canSee == true)
- {
- bj = GameObject.FindWithTag("BJ").transform;
- Vector3 dire = bj.position - soldier.gameObject.transform.position;
- //float angle = Mathf.Atan2(dire.y, dire.x) * Mathf.Rad2Deg;
- dire.Normalize();
- s.mov = dire;
- anim.SetFloat("X", s.mov.x);
- anim.SetFloat("Y", s.mov.y);
- //s.firepoint.transform.position = new Vector3(0f, 0f, 0f);
- s.firepoint.position = transform.position + s.mov.normalized;
- //s.firepoint.transform.Rotate(0, 0, s.mov.z * 360);
- //s.mov = new Vector2(s.dirX * s.bSpeed, s.dirY * s.bSpeed);
- //b.Dir = mov;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement