Example #1
0
 void Awake()
 {
     enemyAnimator = GetComponent <EnemyAnimator>();
     navMeshAgent  = GetComponent <NavMeshAgent>();
     target        = GameObject.FindWithTag(Tags.PLAYER).transform;
     enemySounds   = GetComponentInChildren <EnemySounds>();
 }
Example #2
0
 void Awake()
 {
     enemyAnim  = GetComponent <EnemyAnimator>();
     navAgent   = GetComponent <NavMeshAgent>();
     target     = GameObject.FindWithTag(Tags.PLAYER_TAG).transform;
     enemyAudio = GetComponentInChildren <EnemyAudio>();
 }
Example #3
0
    IEnumerator RunRoutine()
    {
        EnemyAnimator.SetBool("Run", true);
        yield return(new WaitForSeconds(0.14f));

        MovementPattern();
    }
Example #4
0
 public void Start()
 {
     enemyAnimator   = this.GetComponent <EnemyAnimator>();
     enemyNavigator  = this.GetComponent <NavMeshAgent>();
     enemyCombat     = this.GetComponent <CharacterCombat>();
     enemyController = this.GetComponent <EnemyController>();
 }
Example #5
0
    IEnumerator WalkRoutine()
    {
        EnemyAnimator.SetBool("Walk", true);
        yield return(new WaitForSeconds(0.2f));

        MovementPattern();
    }
 private void Awake()
 {
     m_Weapon          = gameObject.GetRequiredComponent <EnemyWeapon>();
     m_Health          = gameObject.GetRequiredComponent <EnemyHealth>();
     m_Animator        = gameObject.GetRequiredComponent <EnemyAnimator>();
     m_StateController = gameObject.GetRequiredComponent <EnemyStateController>();
 }
    void Awake()
    {
        //if it is a boss then increase the health of boss accoring to its level
        if (is_Boss)
        {
            health = 100 + bossLevel * 100;
        }

        //if it is a boss or a cannibal, get the components
        if (is_Boar || is_Cannibal)
        {
            enemy_Anim       = GetComponent <EnemyAnimator>();
            enemy_Controller = GetComponent <EnemyController>();
            navAgent         = GetComponent <NavMeshAgent>();

            // get enemy audio
            enemyAudio = GetComponentInChildren <EnemyAudio>();
        }

        //if it is a player the get the player stats component
        if (is_Player)
        {
            player_Stats = GetComponent <PlayerStats>();
        }
    }
Example #8
0
    private IEnumerator IcebergCoroutine()
    {
        yield return(new WaitForSeconds(icebergFallSeconds));

        Vector3 destructionPosition = icebergSpawner.endPosition.position;

        destructionPosition.y = 0;
        GameObject iceDestructionParticles = Instantiate(iceDestructionPrefab, destructionPosition, iceDestructionPrefab.transform.rotation);

        Destroy(iceDestructionParticles, 2f);

        List <GameObject> enemies = _enemyHolder.enemies;

        for (int i = enemies.Count - 1; i >= 0; i--)
        {
            EnemyDebuff enemyDebuff = enemies[i].GetComponent <EnemyDebuff>();
            if (enemyDebuff != null)
            {
                enemyDebuff.Freeze(freezeDebuffDurationSeconds * effectMultiplier);
            }

            EnemyAnimator enemyAnimator = enemies[i].GetComponent <EnemyAnimator>();
            if (enemyAnimator != null)
            {
                enemyAnimator.Pause(freezeDebuffDurationSeconds * effectMultiplier);
            }

            Health health = enemies[i].GetComponent <Health>();
            health.Sub((int)(7f * effectMultiplier));
        }
    }
Example #9
0
    public void Start()
    {
        this.raycastEnemy = GetComponent <RaycastEnemy>();

        this.myTransform = gameObject.transform;

        this.canAttack = GetComponent <EnemyCanAttack>();

        this.enemyStateMachine = GetComponent <EnemyStateMachine>();

        this.enemyStateMachine.setStateMachineEnemy(StateMachineEnemy.Move);

        this.target = GameObject.Find("Jumba").transform;

        this.controllerHitSequence = target.GetComponent <ControllerHitSequence>();

        this.interfaceHitCombo = target.GetComponent <InterfaceHitCombo>();

        this.controllerHit = target.GetComponent <ControllerHitPlayer>();

        this.strikeForce = target.GetComponent <StrikeForce>();

        this.enemyLife = GetComponent <EnemyLife>();

        this.characterController = GetComponent <CharacterController>();

        this.enemyAnimation = GetComponent <EnemyAnimator>();
    }
Example #10
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         EnemyAnimator.SetBool(targetBool, true);
     }
 }
Example #11
0
 void Awake()
 {
     enemyAnimator   = GetComponent <EnemyAnimator>();
     enemyController = GetComponent <EnemyController>();
     navMeshAgent    = GetComponent <NavMeshAgent>();
     enemyAudio      = GetComponentInChildren <EnemyAudio>();
 }
Example #12
0
    // Update is called once per frame
    void Update()
    {
        GetDistance();
        Vector3 newPlayerPosition = new Vector3(Player.transform.position.x, Player.transform.position.y - 0.5f, Player.transform.position.z);

        Direction = (newPlayerPosition - transform.position).normalized;

        switch (enemyState)
        {
        case EnemyState.Run:
            RunBehaviour();
            RayView();
            break;

        case EnemyState.Attack:
            AttackBehaviour();
            RayView();
            break;

        case EnemyState.Dead:
            StartCoroutine(DeathBehaviour());
            break;

        case EnemyState.Idle:
            IdleBehaviour();
            break;
        }

        if (CurrentHealth < MaxHealth && ReturnPlayerLife())
        {
            attackPlayer = true;
        }

        if (DistanceToPlayer > aggressionDistance)
        {
            enemyState = EnemyState.Idle;
            EnemyAnimator.SetBool("Walk", false);
            Agent.velocity = Vector3.zero;
        }

        if (!attackPlayer && DistanceToPlayer <= aggressionDistance && ReturnPlayerLife())
        {
            enemyState = EnemyState.Run;
        }
        else if (attackPlayer && ReturnPlayerLife())
        {
            enemyState = EnemyState.Run;
        }

        if (DistanceToPlayer <= _shootRange && playerInSight && ReturnPlayerLife())
        {
            enemyState = EnemyState.Attack;
        }

        if (CurrentHealth <= 0)
        {
            enemyState = EnemyState.Dead;
        }
    }
 private void Start()
 {
     rb                 = GetComponent <Rigidbody2D>();
     enemyAnimator      = GetComponent <EnemyAnimator>();
     frogShooting       = GetComponentInChildren <FrogShooting>();
     rayOrigin.position = transform.position;
     Player             = FindObjectOfType <CharacterMovement>().transform;
 }
Example #14
0
    void Start()
    {
        ea = GetComponent <EnemyAnimator>();

        ec = GetComponent <EnemyController>();

        SetHealthToMax();
    }
Example #15
0
 protected override void ClearAnimatorComponent()
 {
     if (enemyAnimator != null)
     {
         enemyAnimator.Clear();
         enemyAnimator = null;
     }
 }
Example #16
0
    private void Awake()
    {
        _shooter        = GetComponent <Shooter>();
        _enemyAnimator  = GetComponent <EnemyAnimator>();
        _characterAudio = GetComponent <CharacterAudio>();

        _target = FindObjectOfType <Player>().transform;
    }
Example #17
0
 void Start()
 {
     player            = GameObject.FindGameObjectWithTag("Player");
     navMesh           = GetComponent <NavMeshAgent>();
     animator          = GetComponent <EnemyAnimator>();
     wanderDestination = transform.position;
     layerMask         = 1 << LayerMask.NameToLayer("Building");
 }
Example #18
0
    public float waitBeforeAttack = 1.5f; //Time between attacks


    void Awake()
    {
        anim       = GetComponent <EnemyAnimator>();
        navAgent   = GetComponent <NavMeshAgent>();
        enemyAudio = GetComponentInChildren <EnemyAudio>();

        target = GameObject.FindWithTag("Player").transform;
    }
Example #19
0
        private void FixedUpdate()
        {
            if (disabledCountDown.CoolDown > 0)
            {
                CountDown.DecreaseTime(disabledCountDown);
                return;
            }

            if (model.IsDead)
            {
                return;
            }

            EnemyUpdate();

            if (enemyController.fow.visibleTargets.Count > 0)
            {
                enemyController.FindTarget(transform);

                if (enemyController.target != null)
                {
                    if (Vector2.Distance(transform.position, enemyController.target.position) > 0.5f)
                    {
                        enemyController.WalkTowardTo(transform, ref model);
                        EnemyAnimator.SetBool("isWalking", true);
                    }
                    else
                    {
                        enemyController.canAttack = true;
                    }
                }
                else
                {
                    EnemyAnimator.SetBool("isWalking", false);
                }
            }
            else
            {
                EnemyAnimator.SetBool("isWalking", false);
                enemyController.target    = null;
                enemyController.canAttack = false;
            }

            if (attackCountDown.CoolDown > 0 && enemyController.canAttack)
            {
                enemyController.Attack(transform, BoxCollider2D.size, playerLayer);
            }


            if (attackCountDown.CoolDown <= 0)
            {
                enemyController.targetsAttacked.Clear();
                if (enemyController.canAttack)
                {
                    attackCountDown.StartToCount();
                }
            }
        }
Example #20
0
 public override void Start()
 {
     EnemyCurrentState = EnemyState.idle;
     EnemyRigidbody    = GetComponent <Rigidbody2D>();
     EnemyAnimator     = GetComponent <Animator>();
     ChaseTarget       = GameObject.FindWithTag("Player").transform;
     EnemyAnimator.SetBool("WakeUp", true);
     FireDelayCount = FireDelay;
 }
Example #21
0
    public void RunBehaviour()
    {
        if (EnemyAnimator.GetBool("Attack") == false)
        {
            StartCoroutine(WalkRoutine());
        }

        PlayGrowl();
    }
 private void Dead()
 {
     isDead = true;
     //EnemyAnimator.enabled = false;
     EnemyAnimator.SetInteger("State", -1);
     boxcoll.enabled = false;
     StartCoroutine(ReserveUnable());//오브젝트 꺼짐 예약
     State = "Exit";
 }
Example #23
0
    // Update is called once per frame
    void Update()
    {
        GetDistance();
        newPlayerPosition = new Vector3(Player.transform.position.x, Player.transform.position.y - 1f, Player.transform.position.z);
        Direction         = (newPlayerPosition - transform.position).normalized;

        switch (enemyState)
        {
        case EnemyState.Run:
            RunBehaviour();
            break;

        case EnemyState.Attack:
            AttackBehaviour();
            break;

        case EnemyState.Dead:
            DeathBehaviour();
            break;

        case EnemyState.Idle:
            IdleBehaviour();
            break;
        }

        if (CurrentHealth < MaxHealth && ReturnPlayerLife())
        {
            attackPlayer = true;
        }

        if (DistanceToPlayer > aggressionDistance)
        {
            enemyState = EnemyState.Idle;
            EnemyAnimator.SetBool("Run", false);
        }

        if (!attackPlayer && DistanceToPlayer <= aggressionDistance && ReturnPlayerLife())
        {
            enemyState = EnemyState.Run;
        }
        else if (attackPlayer && ReturnPlayerLife())
        {
            enemyState = EnemyState.Run;
        }

        if (DistanceToPlayer <= 2.4f && CurrentHealth > 0 && ReturnPlayerLife())
        {
            enemyState = EnemyState.Attack;
            RotateTowards();
        }

        if (CurrentHealth <= 0)
        {
            enemyState = EnemyState.Dead;
        }
    }
 void Start()
 {
     enemyController = GetComponent <EnemyController>();
     enemyAnimator   = GetComponent <EnemyAnimator>();
     shootPoint      = enemyController.shootPoint;
     bulletType.GetComponent <BulletAnimator>().bulletSpeed = bulletSpeed;
     canShoot = true;
     friend   = enemyController.transform.gameObject.name;
     enemy    = PlayerManager.instance.player.gameObject.name;
 }
Example #25
0
    IEnumerator HitBehaviour()
    {
        Agent.speed = 0;
        yield return(new WaitForSeconds(0.05f));

        EnemyAnimator.SetTrigger("GetHit");
        yield return(new WaitForSeconds(0.5f));

        Agent.speed = MovementSpeed;
    }
    private void UpdateAnims()
    {
        float   myVelocity = m_agent.velocity.magnitude;
        Vector3 localVel   = transform.InverseTransformDirection(m_agent.velocity.normalized);

        EnemyAnimator.SetFloat("Velocity", myVelocity);

        EnemyAnimator.SetFloat("MovementDirectionRight", localVel.x);
        EnemyAnimator.SetFloat("MovementDirectionForward", localVel.z);
    }
Example #27
0
    // Used by the gameManager to set up this enemy.
    public void Setup(GameManager gameManager, int sortOrder)
    {
        this.gameManager = gameManager;

        enemyAnimator = GetComponent <EnemyAnimator>();
        healthSystem  = GetComponent <EnemyHealthSystem>();

        enemyAnimator.SetSortingOrder(sortOrder);
        healthSystem.SetSortingOrder(sortOrder);
    }
Example #28
0
 public void AttackBehaviour()
 {
     EnemyAnimator.SetBool("Run", false);
     Agent.velocity = Vector3.zero;
     if (Time.time > NewFireRate)
     {
         NewFireRate = Time.time + FireRate;
         StartCoroutine(AttackRoutine());
     }
 }
    IEnumerator Attack()
    {
        AttackReady = false;
        //공격 모션
        EnemyAnimator.SetInteger("State", 3);
        yield return(new WaitForSeconds(0.8f));

        environment.SendMessage("AttackMain", Power);//메인주인공 공격 알림
        AttackReady = true;
    }
Example #30
0
 public void DeathBehaviour()
 {
     Agent.velocity = Vector3.zero;
     EnemyAnimator.SetBool("Dead", true);
     BoxCollider.enabled = false;
     Joints.SetActive(false);
     Agent.radius = 0;
     PlayDeathGrowl();
     OnKill();
 }
Example #31
0
 void forceSetUp()
 {
     enemyController = GetComponent<EnemyController>();
     enemyAnimator = GetComponent<EnemyAnimator>();
 }
 //Initialization
 public void OnSpawn(EnemyState state)
 {
     m_Agent = (NavMeshAgent)GetComponent<NavMeshAgent> ();
     m_PlayerTransform = GameObject.FindGameObjectWithTag ("Player").transform;
     m_Attack = GetComponent<Attack>();
     m_Animator = GetComponentInChildren<EnemyAnimator> ();
     SetState (state);
 }
Example #33
0
    void Awake()
    {
        Transform guardProxy = transform.Find("GuardProxy");
        Destroy(guardProxy.gameObject);

        guardObj = Instantiate(guardModel, Vector3.zero, Quaternion.identity) as Transform;
        guardObj.name = "GuardModel";
        guardObj.parent = transform;
        guardObj.localPosition = Vector3.zero;
        guardObj.localRotation = Quaternion.identity;
        RagDollController guardRagDoll = guardObj.gameObject.AddComponent<RagDollController>();

        enemyAnimator = GetComponent<EnemyAnimator>();
        if (!enemyAnimator) Debug.Log("ERROR: Can't Find Enemy Animator");

        enemyController = GetComponent<EnemyController>();
        if (!enemyController) Debug.Log("ERROR: Can't Find Enemy Controller");

        Transform guardRoot = guardObj.Find ("Guard_Skeleton/Root");
        if (!guardRoot) Debug.Log("ERROR: Can't Find Guard Root");
        guardRoot.gameObject.AddComponent<ExplosionCatcher>();

        Transform guardHead = guardObj.Find ("Guard_Skeleton/Root/UpperBody/Spine1/Spine2/Neck/Head");
        if (!guardHead) Debug.Log("ERROR: Can't Find Guard Head");

        Transform guardGun = guardObj.Find ("Guard_Geometry/Guard_Gun");
        if (!guardGun) Debug.Log("ERROR: Can't Find Guard Gun");

        //Transform guardGunHolster = guardObj.Find ("Guard_Geometry/Guard_GunHolster");
        //if (!guardGun) Debug.Log("ERROR: Can't Find Guard Gun Holster");

        Transform guardRightHand = guardObj.Find ("Guard_Skeleton/Root/UpperBody/Spine1/Spine2/RightShoulder/RightElbow/RightWrist");
        if (!guardRightHand) Debug.Log("ERROR: Can't Find Guard Hand");

        Transform guardUpperTorso = guardObj.Find ("Guard_Skeleton/Root/UpperBody/Spine1/Spine2");
        if (!guardUpperTorso) Debug.Log("ERROR: Can't Find Guard Torso");

        Transform guardUpperBody = guardObj.Find ("Guard_Skeleton/Root/UpperBody");
        if (!guardUpperBody) Debug.Log("ERROR: Can't Find Guard UpperBody");

        Transform guardBadge = guardObj.Find ("Guard_Geometry/Guard_Badge");
        if (!guardBadge) Debug.Log("ERROR: Can't Find Guard Badge");

        Transform guardHat = guardObj.Find ("Guard_Geometry/Guard_Hat");
        if (!guardHat) Debug.Log("ERROR: Can't Find Guard Hat");

        Transform[] accessories = new Transform[2];
        accessories[0] = guardBadge;
        accessories[1] = guardHat;

        guardGun.parent = guardRightHand;
        guardBadge.parent = guardUpperTorso;
        guardHat.parent = guardHead;

        enemyAnimator.setUp(guardObj, guardUpperBody);
        enemyController.setUp(guardHead,guardRagDoll, accessories);
        enemyController.addWeapon(guardGun);

        setUpData.layerName = "EnemyRagDoll";
        setUpData.rootTransform = guardRoot;
        setUpData.root.collision.center = new Vector3(0.000f, 0.187f, -0.030f);
        setUpData.root.collision.size = new Vector3(0.507f, 0.575f, 0.305f);

        setUpData.leftHip.collision.center = new Vector3(-0.221f, 0.000f, 0.000f);
        setUpData.leftHip.collision.radius = 0.142f;
        setUpData.leftHip.collision.height = 0.475f;
        setUpData.leftHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftHip.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftKnee.collision.center = new Vector3(-0.35f, 0.000f, 0.000f);
        setUpData.leftKnee.collision.radius = 0.114f;
        setUpData.leftKnee.collision.height = 0.459f;
        setUpData.leftKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.leftKnee.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightHip.collision.center = new Vector3(0.237f, 0.000f, 0.000f);
        setUpData.rightHip.collision.radius = 0.142f;
        setUpData.rightHip.collision.height = 0.475f;
        setUpData.rightHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.rightHip.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightKnee.collision.center = new Vector3(0.35f, 0.000f, 0.000f);
        setUpData.rightKnee.collision.radius = 0.114f;
        setUpData.rightKnee.collision.height = 0.459f;
        setUpData.rightKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightKnee.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        setUpData.spine.collision.center = new Vector3(-0.160f, -0.005f, -0.000f);
        setUpData.spine.collision.size = new Vector3(0.321f, 0.304f, 0.507f);
        setUpData.spine.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.spine.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.head.collision.center = new Vector3(0.000f, 0.126f, 0.000f);
        setUpData.head.collision.radius = 0.126f;
        setUpData.head.joint.axis = new Vector3(1.0f, 0.0f, 0.0f);
        setUpData.head.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftShoulder.collision.center = new Vector3(0.174f, 0.000f, 0.000f);
        setUpData.leftShoulder.collision.radius = 0.087f;
        setUpData.leftShoulder.collision.height = 0.343f;
        setUpData.leftShoulder.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftShoulder.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftElbow.collision.center = new Vector3(0.270f, 0.000f, 0.000f);
        setUpData.leftElbow.collision.radius = 0.108f;
        setUpData.leftElbow.collision.height = 0.542f;
        setUpData.leftElbow.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.leftElbow.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightShoulder.collision.center = new Vector3(-0.174f, 0.000f, 0.000f);
        setUpData.rightShoulder.collision.radius = 0.087f;
        setUpData.rightShoulder.collision.height = 0.343f;
        setUpData.rightShoulder.joint.axis = new Vector3(0.0f, 1.0f, 0.0f);
        setUpData.rightShoulder.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightElbow.collision.center = new Vector3(-0.270f, 0.000f, 0.000f);
        setUpData.rightElbow.collision.radius = 0.108f;
        setUpData.rightElbow.collision.height = 0.542f;
        setUpData.rightElbow.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightElbow.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        guardRagDoll.setUp(setUpData);
    }
Example #34
0
	void Awake()
	{
		damageDealer = GetComponent<DamageDealer>();
		damageTaker = GetComponent<DamageTaker>();
		enemyAnimator = GetComponent<EnemyAnimator>();
	}
Example #35
0
    public void setUp(Transform newHead, RagDollController newRagdoll, Transform[] newAccessories)
    {
        head = newHead;
        ragDoll = newRagdoll;
        accessories = newAccessories;
        pathMover = GetComponent<PathMover>();
        player = GameObject.FindWithTag ("Player").transform;
        GameObject guardRoomObj = GameObject.FindWithTag("GuardRoom");
        if (guardRoomObj) guardRoom = guardRoomObj.GetComponent<GuardRoom>();

        enemyAI = GetComponent<EnemyAI>();
        enemyAnimator = GetComponent<EnemyAnimator>();
        characterController = GetComponent<CharacterController>();
        startWalking();
        Events.Listen(gameObject, "SoundEvents");

        //color the minimap dot
        Transform miniMapDot = transform.Find("MiniMapUnit");
        if (miniMapDot) {
            switch (EnemyType) {
            case EnemyTypes.Guard :
                miniMapDot.renderer.material.color = Color.red;
                break;
            case EnemyTypes.Janitor :
                miniMapDot.renderer.material.color = Color.cyan;
                break;
            default :
                miniMapDot.renderer.material.color = Color.black;
                break;
            }
            miniMapDot.renderer.material.renderQueue = 3000 + Random.Range(1, 500);
        }
    }
Example #36
0
    void Awake()
    {
        Transform janitorProxy = transform.Find("JanitorProxy");
        Destroy(janitorProxy.gameObject);

        janitorObj = Instantiate(janitorModel, Vector3.zero, Quaternion.identity) as Transform;
        janitorObj.name = "JanitorModel";
        janitorObj.parent = transform;
        janitorObj.localPosition = Vector3.zero;
        janitorObj.localRotation = Quaternion.identity;
        RagDollController janitorRagDoll = janitorObj.gameObject.AddComponent<RagDollController>();

        enemyAnimator = GetComponent<EnemyAnimator>();
        if (!enemyAnimator) Debug.Log("ERROR: Can't Find Enemy Animator");

        enemyController = GetComponent<EnemyController>();
        if (!enemyController) Debug.Log("ERROR: Can't Find Enemy Controller");

        Transform janitorRoot = janitorObj.Find ("Janitor_Skeleton/Root");
        if (!janitorRoot) Debug.Log("ERROR: Can't Find janitor Root");
        janitorRoot.gameObject.AddComponent<ExplosionCatcher>();

        Transform janitorHead = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody/Spine1/Spine2/Neck/Head");
        if (!janitorHead) Debug.Log("ERROR: Can't Find Janitor Head");

        Transform janitorUpperBody = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody");
        if (!janitorUpperBody) Debug.Log("ERROR: Can't Find janitorUpperBody");

        Transform janitorRightHand = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody/Spine1/Spine2/RightShoulder/RightElbow/RightWrist");
        if (!janitorRightHand) Debug.Log("ERROR: Can't Find Janitor Hand");

        Transform janitorUpperTorso = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody/Spine1/Spine2");
        if (!janitorUpperTorso) Debug.Log("ERROR: Can't Find Janitor Torso");

        Transform janitorMop = janitorObj.Find ("Janitor_Geometry/Janitor_Mop");
        if (!janitorMop) Debug.Log("ERROR: Can't Find Janitor Mop");

        Transform janitorBucket = janitorObj.Find ("Janitor_Geometry/Janitor_Bucket");
        if (!janitorBucket) Debug.Log("ERROR: Can't Find Janitor Bucket");

        Transform[] accessories = new Transform[2];
        accessories[0] = janitorMop;
        accessories[1] = janitorBucket;

        enemyAnimator.setUp(janitorObj, janitorUpperBody);
        enemyController.setUp(janitorHead, janitorRagDoll, accessories);

        setUpData.layerName = "EnemyRagDoll";
        setUpData.rootTransform = janitorRoot;
        setUpData.root.collision.center = new Vector3(0.000f, 0.187f, -0.030f);
        setUpData.root.collision.size = new Vector3(0.507f, 0.575f, 0.305f);

        setUpData.leftHip.collision.center = new Vector3(-0.221f, 0.000f, 0.000f);
        setUpData.leftHip.collision.radius = 0.142f;
        setUpData.leftHip.collision.height = 0.475f;
        setUpData.leftHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftHip.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftKnee.collision.center = new Vector3(-0.35f, 0.000f, 0.000f);
        setUpData.leftKnee.collision.radius = 0.114f;
        setUpData.leftKnee.collision.height = 0.459f;
        setUpData.leftKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.leftKnee.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightHip.collision.center = new Vector3(0.237f, 0.000f, 0.000f);
        setUpData.rightHip.collision.radius = 0.142f;
        setUpData.rightHip.collision.height = 0.475f;
        setUpData.rightHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.rightHip.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightKnee.collision.center = new Vector3(0.35f, 0.000f, 0.000f);
        setUpData.rightKnee.collision.radius = 0.114f;
        setUpData.rightKnee.collision.height = 0.459f;
        setUpData.rightKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightKnee.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        setUpData.spine.collision.center = new Vector3(-0.160f, -0.005f, -0.000f);
        setUpData.spine.collision.size = new Vector3(0.321f, 0.304f, 0.507f);
        setUpData.spine.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.spine.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.head.collision.center = new Vector3(0.000f, 0.126f, 0.000f);
        setUpData.head.collision.radius = 0.126f;
        setUpData.head.joint.axis = new Vector3(1.0f, 0.0f, 0.0f);
        setUpData.head.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftShoulder.collision.center = new Vector3(0.174f, 0.000f, 0.000f);
        setUpData.leftShoulder.collision.radius = 0.087f;
        setUpData.leftShoulder.collision.height = 0.343f;
        setUpData.leftShoulder.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftShoulder.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftElbow.collision.center = new Vector3(0.270f, 0.000f, 0.000f);
        setUpData.leftElbow.collision.radius = 0.108f;
        setUpData.leftElbow.collision.height = 0.542f;
        setUpData.leftElbow.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.leftElbow.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightShoulder.collision.center = new Vector3(-0.174f, 0.000f, 0.000f);
        setUpData.rightShoulder.collision.radius = 0.087f;
        setUpData.rightShoulder.collision.height = 0.343f;
        setUpData.rightShoulder.joint.axis = new Vector3(0.0f, 1.0f, 0.0f);
        setUpData.rightShoulder.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightElbow.collision.center = new Vector3(-0.270f, 0.000f, 0.000f);
        setUpData.rightElbow.collision.radius = 0.108f;
        setUpData.rightElbow.collision.height = 0.542f;
        setUpData.rightElbow.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightElbow.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        janitorRagDoll.setUp(setUpData);
        //
    }
Example #37
0
 void Start()
 {
     Events.Listen(gameObject, "GuardRadio");
     enemyController = GetComponent<EnemyController>();
     enemyAnimator = GetComponent<EnemyAnimator>();
     pathMover = GetComponent<PathMover>();
     if (!enemyAnimator) print ("ERROR: No enemy animator");
 }