Exemple #1
0
    void GiveUpVirgo()
    {
        Utilities.SetLayerOfAllChildrens(linkedVirgo, 13);

        curVirgoState  = VirgoState.Discovered;
        curAttackState = AttackState.Normal;

        linkedVirgo.SetParent(Game_NG.PhysicsHolder);

        Rigidbody virgoR = linkedVirgo.gameObject.AddComponent <Rigidbody>();

        virgoR.mass            = virgoMass;
        virgoR.angularVelocity = Random.onUnitSphere * 5f;

        Agent.speed = moveSpeed;

        Agent.velocity = (Random.Range(0f, 1f) > 0.5f ? Visual.right : -Visual.right) * sideStepSpeed;

        if (grabAttack != null)
        {
            Destroy(grabAttack.gameObject);
        }

        if (linkedVirgo.Find("TrapTrigger") != null)
        {
            Destroy(linkedVirgo.Find("TrapTrigger").gameObject);
        }
    }
Exemple #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.layer == LayerMask.NameToLayer("Player") && curVirgoState == VirgoState.Waiting)
     {
         curVirgoState = VirgoState.Attacking;
         Agent.speed   = trapSpeed;
     }
 }
Exemple #3
0
    void OnAttackHit(HitInfos hit)
    {
        if (hit.AttackObject == grabAttack)
        {
            curVirgoState  = VirgoState.AttackSucceed;
            curAttackState = AttackState.Attacking;

            targetBody = hit.Attacked.LinkedThing.Body;
            Visual.LookAt(targetBody.position.SetY(Body.position.y));

            Destroy(grabAttack.gameObject);
            Destroy(linkedVirgo.Find("TrapTrigger").gameObject);
        }
    }
Exemple #4
0
    protected virtual void VirgoBehaviour()
    {
        switch (CurVirgoState)
        {
        case VirgoState.Waiting:
            CheckAround(nearDistBeforeAttacking);

            if (targetBody != null)
            {
                GiveUpVirgo();
            }


            SetDestination(oPos);
            break;

        case VirgoState.Attacking:

            SetDestination(oPos + Body.forward * trapMaxDist);

            if ((Body.position - oPos).magnitude >= trapMaxDist)
            {
                curVirgoState = VirgoState.Waiting;
            }
            break;

        case VirgoState.AttackSucceed:
            SetDestination((targetBody.position + (Body.position - posInVirgo.position)).SetY(Body.position.y));

            if (targetBody.GetComponentInParent <LivingBeing>().CurLivingState != LivingBeing.LivingState.Stunned)
            {
                GiveUpVirgo();
            }
            break;

        case VirgoState.Discovered:
            base.Update();
            break;
        }
    }