Exemple #1
0
 public void OnPlayerCharacterDie(CPlayerCharacter Character)
 {
     if (EControllerType.Player1 == Character.controller_type)
     {
         SceneManager.LoadScene("Lobby");
     }
 }
    public override bool FindNearestTarget()
    {
        if (TargetObj)
        {
            return(true);
        }

        bool    bFinded         = false;
        float   CheckTargetDist = 100.0f;
        Vector3 CurPos          = gameObject.transform.position;

        GameObject[] FindObjs = GameObject.FindGameObjectsWithTag("PlayerCharacter");
        foreach (GameObject FindObj in FindObjs)
        {
            CPlayerCharacter FindChar = FindObj.GetComponent <CPlayerCharacter>();
            if (FindChar.curState != EState.Die)
            {
                float TargetDist = Vector3.Distance(FindObj.transform.position, CurPos);
                if (TargetDist < CheckTargetDist && TargetDist <= EyeSight)
                {
                    CheckTargetDist = TargetDist;
                    TargetObj       = FindObj;
                    bFinded         = true;
                }
            }
        }
        return(bFinded);
    }
Exemple #3
0
    public void Init(CPlayerCharacter character)
    {
        _character = character;

        Transform anim = _character.transform.GetChild(0);

        _spirte   = anim.GetComponent <SpriteRenderer>();
        _animator = anim.GetComponent <Animator>();
    }
Exemple #4
0
 public void OnPlayerCharacterHit(CPlayerCharacter Character)
 {
     if (EControllerType.Player1 == Character.controller_type)
     {
     }
 }
Exemple #5
0
    public override void Init(CUnit character)
    {
        base.Init(character);

        _character = character as CPlayerCharacter;
    }
Exemple #6
0
    private void Awake()
    {
        _speed = 0.05f;

        _character = GameObject.Find("Player").GetComponent <CPlayerCharacter>();
    }
Exemple #7
0
 public void SetController(CPlayerCharacter character)
 {
     _character = character;
     _character.Init(this);
 }