Ejemplo n.º 1
0
 private float currentWaitTime; //巡逻点的等待时间,默认为5
 public PatrolState(ZombieAI zAI)
 {
     zombieAI        = zAI;
     zombieMove      = zombieAI.GetComponent <ZombieMovement>();
     waypointIndex   = 0;
     currentWaitTime = 5f;
 }
Ejemplo n.º 2
0
 void Start()
 {
     zombie          = GetComponent <Zombie>();
     zombieMovement  = GetComponent <ZombieMovement>();
     playerPosition  = GetComponent <PlayerPosition>();
     slomoController = FindObjectOfType <SlomoController>();
 }
Ejemplo n.º 3
0
    void Start()
    {
        myTransform = transform;
        movScript = GetComponent<ZombieMovement> ();

        if (isServer)
            StartCoroutine ( Attack () );
    }
    void Awake()
    {
        zombieMovement = GetComponent <ZombieMovement>();
        zombieLife     = GetComponent <Life>();

        zombieMovement.OnAttackRange.AddListener(FocusOnTarget);
        zombieMovement.OutOfAttackRange.AddListener(LeaveTarget);
    }
Ejemplo n.º 5
0
 void Start()
 {
     zombieAnimator  = GetComponent <Animator>();
     zombieRigidBody = GetComponent <Rigidbody2D>();
     zombieHealth    = GetComponent <ZombieHealth>();
     zombieMovement  = GetComponent <ZombieMovement>();
     zombieIK2D      = GetComponent <UnityEngine.U2D.IK.IKManager2D>();
 }
Ejemplo n.º 6
0
 void Start()
 {
     zombie         = GetComponent <Zombie>();
     zombieHealth   = GetComponent <ZombieHealth>();
     zombieMovement = GetComponent <ZombieMovement>();
     player         = FindObjectOfType <Player>();
     playerPosition = GetComponent <PlayerPosition>();
 }
Ejemplo n.º 7
0
 public ChasingState(ZombieAI zAI)
 {
     zombieAI   = zAI;
     zombieMove = zombieAI.GetComponent <ZombieMovement>();
     animator   = zombieAI.GetComponent <Animator>();
     timer      = GameObject.FindGameObjectWithTag("GameController").GetComponent <Timer>();
     isScreamed = false;
     attacked   = false;
 }
Ejemplo n.º 8
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Interactable")
     {
         ZombieMovement movement = GetComponent <ZombieMovement>();
         movement.Death();
         audio.Play();
     }
 }
Ejemplo n.º 9
0
    private void Start()
    {
        anim           = GetComponentInChildren <Animator>();
        player         = FindObjectOfType <Player.Player>();
        rb             = GetComponent <Rigidbody2D>();
        zombieMovement = GetComponent <ZombieMovement>();
        path           = GetComponent <AIPath>();

        ChangeState(ZombieStates.Stand);
    }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        animator            = GetComponent <Animator>();
        zombieAI            = GetComponent <ZombieAI>();
        zombieAudio         = GetComponent <ZombieAudio>();
        bodyParts           = GetComponentsInChildren <Rigidbody>();
        zombieMovement      = GetComponent <ZombieMovement>();
        characterController = GetComponent <CharacterController>();

        EnableRagdoll(false);
    }
Ejemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        _player = FindObjectOfType <Player>();

        _rigidbody2D = GetComponent <Rigidbody2D>();

        _animator = GetComponentInChildren <Animator>();

        _zombieMovement = GetComponent <ZombieMovement>();

        ChangeState(ZombieStates.Stand); // состояние зомби при старте игры stand(стоит на месте)
    }
Ejemplo n.º 12
0
    private void Start()
    {
        var player = GameManager.Instance.player.transform;

        if (player != null && behavior.CurrentState != State.TRIGGER)
        {
            Target = player;
        }
        Init();
        _movement = GetComponent <ZombieMovement>();
        GetComponent <DamageSystem>().onTargetDied    += KillZombie;
        GetComponent <DamageSystem>().onTargetDamaged += d => DamageTaken();
    }
Ejemplo n.º 13
0
    void Awake()
    {
        animator       = GetComponent <Animator>();
        agent          = GetComponent <NavMeshAgent>();
        zombieMovement = GetComponent <ZombieMovement>();
        zombieLife     = GetComponent <Life>();

        zombieLife.OnHit.AddListener(HitAnimation);
        zombieLife.OnDeath.AddListener(DeathAnimation);

        zombieMovement.OnAttackRange.AddListener(AttackAnimation);
        zombieMovement.OutOfAttackRange.AddListener(StopAttacking);
    }
Ejemplo n.º 14
0
    void OnTriggerEnter(Collider col)
    {
        Rigidbody rig = col.transform.GetComponent <Rigidbody>();

        if (rig == null)
        {
            rig = col.transform.root.GetComponent <Rigidbody>();
        }
        ZombieMovement zmov = col.transform.root.GetComponent <ZombieMovement>();

        FallDeath falldeath = col.transform.root.GetComponentInChildren <FallDeath>();

        if (falldeath != null)
        {
            falldeath.FallingAnim();
        }

        Health hcol = col.transform.root.GetComponentInChildren <Health>();

        if (hcol != null)
        {
            hcol.m_killedbyPlayer = true;
        }

        if (rig != null)
        {
            GameObject tSmack = Instantiate(smackParticle, transform.position, transform.rotation);
            cShake.ShakeCamera(0.015f, 0.03f);

            PlayHitSound(col.transform.position);

            if (zmov != null)
            {
                zmov.DisableMovement(1);
            }
            Vector3 moveDir = (col.transform.position - transform.root.position).normalized;

            if (zmov != null && !zmov.unstopable)
            {
                rig.constraints = RigidbodyConstraints.None;
                rig.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationY;
                rig.useGravity  = true;
            }
            rig.AddForceAtPosition(moveDir * forceMult, transform.root.position, ForceMode.Impulse);
        }
    }
Ejemplo n.º 15
0
    // Start is called before the first frame update
    void Start()
    {
        movement = GetComponent <ZombieMovement>();
        anim     = GetComponent <ZombieAnimation>();

        alive = true;

        if (GameplayController.instance.zombieGoal == ZombieGoal.PLAYER)
        {
            target = GameObject.FindGameObjectWithTag(TagManager.PLAYER_TAG).transform;
        }
        else if (GameplayController.instance.zombieGoal == ZombieGoal.FENCE)
        {
            GameObject[] fences = GameObject.FindGameObjectsWithTag(TagManager.FENCE_TAG);
            target = fences[Random.Range(0, fences.Length)].transform;
        }
    }
Ejemplo n.º 16
0
 private void Awake()
 {
     zombieMovement = GameObject.FindObjectOfType <ZombieMovement>();
     ghostMovement  = GameObject.FindObjectOfType <GhostMovement>();
     camera         = GameObject.FindObjectOfType <CameraFollowPlayer>();
 }
Ejemplo n.º 17
0
 void Start()
 {
     zombieMovement = GetComponent <ZombieMovement>();
     zombieHealth   = GetComponent <ZombieHealth>();
 }
Ejemplo n.º 18
0
 public ZombieInfo(GameObject zombie)
 {
     movement = zombie.GetComponent <ZombieMovement>();
     attack   = zombie.GetComponent <ZombieAttack>();
 }
Ejemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     zombie = ZombieMovement.FindObjectOfType <ZombieMovement>();
 }
Ejemplo n.º 20
0
 private void Start()
 {
     controller = GetComponent <ZombieMovement>();
 }
Ejemplo n.º 21
0
 private void Awake()
 {
     _zombieMovement = GetComponent <ZombieMovement>();
 }
 // Use this for initialization
 void Start()
 {
     zombMove = zombie.GetComponent<ZombieMovement> ();
     InvokeRepeating ("spawnZombie", varTime, repeatRate);
 }
Ejemplo n.º 23
0
 void Start()
 {
     anim = this.GetComponent<Animator> ();
     movement = this.GetComponent<ZombieMovement> ();
     players = Health.FindObjectsOfType<Health> ();
 }