Beispiel #1
0
    void Awake()
    {
        visualContainer  = transform.Find("Container");
        m_spriteRenderer = visualContainer.Find("Sprite").GetComponent <SpriteRenderer>();
        m_animator       = GetComponentInChildren <Animator> ();

        healthBar = GetComponentInChildren <Healthbar> ();
        healthBar.Disable();
        hostType = HostFigureType.Soldier;
        UpdateAnimationState("Walk Front");
    }
Beispiel #2
0
    public void Init(HostFigureType hostType)
    {
        this.hostType = hostType;
        UpdateAnimationState("Walk Front");

        m_pathPoints = new List <Vector3>();
        m_pathPoints.Add(transform.localPosition);
        Vector3 lastPos;

        for (int i = 0; i < Random.Range(4, 10); i++)
        {
            lastPos = m_pathPoints[m_pathPoints.Count - 1];
            m_pathPoints.Add(new Vector2(
                                 Random.Range(Mathf.Max(GameManager.Instance.spawnableArea.min.x, lastPos.x - PATH_POINT_DIFF), Mathf.Min(GameManager.Instance.spawnableArea.max.x, lastPos.x + PATH_POINT_DIFF)),
                                 Random.Range(Mathf.Max(GameManager.Instance.spawnableArea.min.y, lastPos.y - PATH_POINT_DIFF), Mathf.Min(GameManager.Instance.spawnableArea.max.y, lastPos.y + PATH_POINT_DIFF))
                                 ));
        }

        MoveToNextPoint();
    }
Beispiel #3
0
 public void SetHostType(HostFigureType newHostType)
 {
     hostType = newHostType;
     UpdateAnimationState("Walk Front");
 }
Beispiel #4
0
 void TurnToZombie()
 {
     hostType = HostFigureType.Zombie;
     UpdateAnimationState("Walk Front");
 }