コード例 #1
0
        public IEnumerator Execute()
        {
            while (owner.StateMachine.CurrentState is PatrolState)
            {
                var isPatrol = Random.Range(1, 3) == 1;
                if (isPatrol)
                {
                    var startPos      = owner.transform.position;
                    var numberOfMoves = Random.Range(1, 10);
                    while (numberOfMoves > 0)
                    {
                        EnemyAnimations.ResetAllAnimParameters(owner);
                        EnemyAnimations.SetAnimation(owner, "Walk");
                        var dest = startPos + new Vector3(Random.Range(-10f, 10f), 0, Random.Range(-10f, 10f));
                        agent.SetDestination(dest);
                        var time = (dest - owner.transform.position).magnitude / agent.speed;
                        yield return(new WaitForSeconds(time));

                        numberOfMoves--;
                    }
                }
                else
                {
                    agent.ResetPath();
                    EnemyAnimations.ResetAllAnimParameters(owner);
                    EnemyAnimations.SetAnimation(owner, "Idle");
                    yield return(new WaitForSeconds(ownerChillTime));
                }
            }
        }
コード例 #2
0
    public override void DisplayTab()
    {
        //UI Code here
        objectName = EditorGUILayout.TextField("Name of Object", objectName);
        ChangeName();

        GUILayout.Space(5);

        if (movement != null)
        {
            movement.MoveSpeed = EditorGUILayout.FloatField("Speed", movement.MoveSpeed);
            GUILayout.Space(5);
        }

        if (controller != null && animator != null)
        {
            EditorGUILayout.LabelField("Animations", EditorStyles.boldLabel);

            animator.runtimeAnimatorController = EditorGUILayout.ObjectField("Animation Controller", animator.runtimeAnimatorController, typeof(RuntimeAnimatorController), false) as RuntimeAnimatorController;

            GUILayout.Space(5);

            animations = EditorGUILayout.ObjectField("Animations", animations, typeof(EnemyAnimations), false) as EnemyAnimations;
            ChangeAnimation();
        }
    }
コード例 #3
0
    public void Start()
    {
        spelplan            = GameObject.Find("Spelplan");
        characterAnimations = GameObject.Find("PlayerMary").GetComponent <CharacterAnimations>();
        enemyAnimations     = GameObject.Find("PlayerEnemy").GetComponent <EnemyAnimations>();
        rewardScreen        = GameObject.Find("PController").GetComponent <RewardScreen>();
        lastMove            = GameObject.Find("PController").GetComponent <LastMove>();
        hellStaff           = GameObject.Find("PController").GetComponent <HellStaff>();
        darknightStaff      = GameObject.Find("PController").GetComponent <DarkNightStaff>();
        moonStaff           = GameObject.Find("PController").GetComponent <MoonStaff>();
        skeletonStaff       = GameObject.Find("PController").GetComponent <SkeletonStaff>();
        pumpkinStaff        = GameObject.Find("PController").GetComponent <PumpkinStaff>();
        mirrorStaff         = GameObject.Find("PController").GetComponent <MirrorStaff>();
        playerTurn          = 0;

        marysHealth = marysMaxHealth;
        enemyHealth = enemyMaxHealth;

        firstTurn = true;

        Marks(playerMarks, enemyMarks);

        pumpkinStaff.PumpkinStaffPassiveAbility();

        lastMove.staffUsed = true;
    }
コード例 #4
0
    void Minigun(EnemyAnimations meme)
    {
        damage = 250;
        range  = 70;


        //If statement if we hit something
        //   Debug.Log("Minigun");
        y++;
        if (ammoMP <= 0)
        {
            //     Animator anim = GetComponent<Animator>();
            anim.SetTrigger("MP40StopFiring");
            firing = false;
        }
        else
        {
            // Debug.Log("Can damage");
            if (y % 8 == 0)
            {
                ammoMP--;
                ammoMP--;
                ammoMP--;
                if (meme != null)
                {
                    meme.takeDamage(damage * Random.Range(0.5f, 1.5f));
                }
            }
        }
    }
コード例 #5
0
 public static void LoadSettings(ContentManager content)
 {
     EnemyAnimations.LoadAnimations(content);
     SettingsManager.LoadClasses();
     SettingsManager.LoadEffects();
     SettingsManager.LoadEnemies();
 }
コード例 #6
0
    void Gun()
    {
        damage = 400;
        range  = 100;
        //  Animator anim = GetComponent<Animator>();
        anim.SetTrigger("ToKnife");
        RaycastHit hit;

        //If statement if we hit something
        if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 100))
        {
            //    Debug.Log(hit.transform.name);

            EnemyAnimations target = hit.transform.GetComponent <EnemyAnimations>();
            y++;


            if (target != null)
            {
                //    if (y % 2 == 0)
                {
                    //  Debug.Log("Can damage");
                    target.takeDamage(400 * Random.Range(0.5f, 1.5f));
                }
            }
        }
    }
コード例 #7
0
 protected virtual void Awake()
 {
     animationScript = GetComponent <EnemyAnimations>();
     detectionScript = GetComponent <EnemyDetection>();
     aI            = GetComponent <NavMeshAgent>();
     currentState  = EnemyState.Initial;
     awaitReaction = new WaitForSeconds(reactionTime);
 }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     m_NavMesh         = GetComponent <NavMeshAgent>();
     m_GuardTransform  = GetComponent <Transform>();
     m_EnemyAnimations = GetComponent <EnemyAnimations>();
     m_CurrentWaypoint = Random.Range(0, m_WayPoints.Count);
     m_NavMesh.SetDestination(m_WayPoints[m_CurrentWaypoint].position);
 }
コード例 #9
0
 public override void GetComponents()
 {
     base.GetComponents();
     //get components
     soundFX = GetComponent <EnemySoundFX>();
     enemy   = GetComponent <Enemy>();
     bounds  = GetComponent <Collider2D>().bounds;
     anim    = GetComponent <EnemyAnimations>();
 }
コード例 #10
0
 void Start()
 {
     // audioSource = gameObject.AddComponent<AudioSource>();
     enemyAnimator   = GetComponent <EnemyAnimations>();
     enemyTypeDamage = GetComponent <EnemyTypes>();
     enemySound      = GetComponent <EnemySoundEffect>();
     // player = GameObject.FindWithTag("PlayerFPS").transform;
     player       = GameObject.FindWithTag("PlayerScripts").transform;
     timeBtwShots = startTimeBtwShots;
 }
コード例 #11
0
ファイル: ChasingState.cs プロジェクト: jumberr/Journey3.0
 public IEnumerator Execute()
 {
     EnemyAnimations.ResetAllAnimParameters(owner);
     EnemyAnimations.SetAnimation(owner, "Walk");
     while (owner.StateMachine.CurrentState is ChasingState)
     {
         LookAt(player);
         agent.SetDestination(player.position);
         yield return(null);
     }
 }
コード例 #12
0
 public void PlayAnimation(EnemyAnimations animation)
 {
     if(animation > EnemyAnimations.Death)
     {//Attack or Transition
         i_Animator.Play(m_AnimationNames[(int)animation], m_AnimationLayers[(int)animation]);
     }
     else if(animation <= EnemyAnimations.Death)
     {//basic motion or Death
         i_Animator.Play(m_AnimationNames[(int)animation], m_AnimationLayers[(int)animation]);
     }
 }
コード例 #13
0
 public override void OnSelectionChanged(GameObject selection)
 {
     objectName     = selection.name;
     this.selection = selection;
     controller     = selection.GetComponent <EnemyController>();
     animator       = selection.GetComponent <Animator>();
     if (controller != null)
     {
         animations = controller.animations;
     }
     movement = selection.GetComponent <MultidirectionalTransformMovement>();
 }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     isAlive         = true;
     dieWait         = 15.0f;
     ImOnScreen      = false;
     zombieAnim      = gameObject.GetComponent <EnemyAnimations>();
     Player          = GameObject.FindGameObjectWithTag("Player");
     health          = enemy.enemy_health;
     mov_speed       = enemy.enemy_mov_speed;
     attack_speed    = enemy.enemy_attack_speed;
     attack_cooldown = attack_speed;
     agent           = this.gameObject.GetComponent <NavMeshAgent>();
 }
コード例 #15
0
ファイル: Enemy.cs プロジェクト: Jprummel/Dungeon-Caster
 protected override void Awake()
 {
     base.Awake();
     _move           = GetComponent <MoveObject>();
     _healthbar      = GetComponent <Healthbar>();
     _currentHealth  = _maxHealth;
     _anims          = GetComponent <EnemyAnimations>();
     _player         = GameObject.FindGameObjectWithTag(Tags.PLAYER).GetComponent <Player>();
     _playerObject   = GameObject.FindGameObjectWithTag(Tags.PLAYER).GetComponent <Transform>();
     _enemySpawner   = GameObject.FindGameObjectWithTag(Tags.ENEMYSPAWNER).GetComponent <EnemySpawner>();
     _move.MoveSpeed = GameObject.FindGameObjectWithTag(Tags.MAPDIFFICULTYMANAGER).GetComponent <SetMapSpeed>().EnemyMoveSpeed;
     _enemySpawner.Enemies.Add(this.gameObject);
     _collider = GetComponent <BoxCollider2D>();
 }
コード例 #16
0
    private void Start()
    {
        _transform = GetComponent <Transform>();
        _enemyAnim = GetComponent <EnemyAnimations>();


        _target = GameObject.FindWithTag(CharacterTags.PLAYER_TAG).transform;

        currentAttackTime = defaultAttackTime;

        RouletteWheel();
        //_player = GetComponent<Player>();

        //_attackCollider = GetComponent<AttackColliders>();
    }
コード例 #17
0
    void Start()
    {
        itsef = gameObject.GetComponent <EnemyTest>();

        currentLife = maxLife;

        agent = GetComponent <NavMeshAgent>();

        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();

        gm = GameObject.FindGameObjectWithTag("Managers").GetComponent <GameManager>();

        audPlay = GetComponentInChildren <AudioPlayer>();

        stealth = player.GetComponentInChildren <StealthSystem>();

        playerDetector = GetComponentInChildren <EnemyPlayerDetector>();

        sight = GetComponentInChildren <EnemySight>();

        attack = GetComponentInChildren <EnemyAttackArea>();

        execution = GetComponentInChildren <ExecutionArea>();

        rigid = GetComponent <Rigidbody>();

        anim = GetComponent <EnemyAnimations>();

        anim.Initialize();

        playerDetector.Initialize();

        sight.Initialize();

        execution.Initialize();

        states = State.Stationary;

        StationarySet();

        generalWaitOnPointTime = initGeneralWaitOnPointTime;
        waitOnPointTime        = initWaitOnPointTime;
        waitComeFromSound      = initWaitComeFromSound;
        percentageOfWait       = initPercentageOfWait;
    }
コード例 #18
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        EnemyAnimations script = (EnemyAnimations)target;

        if (script.enemy == null)
        {
            return;
        }

        if (script.enemy.GetComponent <Animator>())
        {
            Animator        animator    = script.enemy.GetComponent <Animator>();
            AnimationClip[] clips       = animator.runtimeAnimatorController.animationClips;
            string[]        clipsString = new string[clips.Length];

            for (int i = 0; i < clips.Length; i++)
            {
                clipsString[i] = clips[i].name;
            }

            GUILayout.Space(10);
            EditorGUILayout.LabelField("Idle Animation", EditorStyles.boldLabel);
            script.choiceIndexIdle = EditorGUILayout.Popup("Idle", script.choiceIndexIdle, clipsString);
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Walk Animation", EditorStyles.boldLabel);
            script.choiceIndexWalk = EditorGUILayout.Popup("Walk", script.choiceIndexWalk, clipsString);
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Attack Animation", EditorStyles.boldLabel);
            script.choiceIndexAttack = EditorGUILayout.Popup("Attack", script.choiceIndexAttack, clipsString);
            GUILayout.Space(10);
            EditorGUILayout.LabelField("Hurt Animation", EditorStyles.boldLabel);
            script.choiceIndexHurt = EditorGUILayout.Popup("Hurt", script.choiceIndexHurt, clipsString);

            script.idleAnimation   = clipsString[script.choiceIndexIdle];
            script.walkAnimation   = clipsString[script.choiceIndexWalk];
            script.attackAnimation = clipsString[script.choiceIndexAttack];
            script.hurtAnimation   = clipsString[script.choiceIndexHurt];

            EditorUtility.SetDirty(target);
        }
    }
コード例 #19
0
ファイル: AttackState.cs プロジェクト: jumberr/Journey3.0
        public IEnumerator Execute()
        {
            agent.ResetPath();

            if (owner.EnemySo.TypeEnemy == EnemySO.EnemyType.Ranged)
            {
                Coroutine lookAtCoroutine = null;
                while (owner.StateMachine.CurrentState is AttackState)
                {
                    EnemyAnimations.ResetAllAnimParameters(owner);
                    EnemyAnimations.SetAnimation(owner, "Attack");
                    if (!(lookAtCoroutine is null))
                    {
                        owner.StopCoroutine(lookAtCoroutine);
                    }
                    lookAtCoroutine = owner.StartCoroutine(LookAtPlayer(player));

                    if (Physics.Raycast(owner.transform.position, owner.transform.TransformDirection(Vector3.forward), out var hit,
                                        layerMask))
                    {
                        owner.Line.SetPosition(0, owner.transform.position);
                        owner.Line.SetPosition(1, hit.point);

                        if (hit.transform.TryGetComponent <PlayerHealth>(out var plHealth))
                        {
                            plHealth.playerHealthDecrease.Invoke(owner.EnemyRaw.Damage);
                        }
                    }
                    else
                    {
                        owner.Line.SetPosition(0, owner.transform.position);
                        owner.Line.SetPosition(1, owner.transform.TransformDirection(Vector3.forward));
                    }

                    yield return(new WaitForSeconds(ownerAnimator.GetCurrentAnimatorStateInfo(0).length));
                }
コード例 #20
0
ファイル: Enemy.cs プロジェクト: Oliverreason/sitsdev
 public void SetAnimation(EnemyAnimations animation, bool reset, bool enableLoop, bool waitFinish)
 {
     SetAnimation((int)animation, reset, enableLoop, waitFinish);
 }
コード例 #21
0
 void Start()
 {
     anim    = GetComponent <EnemyAnimations>();
     enemy   = GetComponent <Enemy>();
     soundFX = GetComponent <EnemySoundFX>();
 }
コード例 #22
0
 public Skull(EnemyAnimations enemyAnimations, Vector2 initialPosition)
 {
 }
コード例 #23
0
ファイル: Bald.cs プロジェクト: GameDeva/Codename-Slash
 public Bald(EnemyAnimations enemyAnimations, Vector2 initialPosition)
 {
 }
コード例 #24
0
    void Update()
    {
        Ammo();
        Health();
        if (health > 0)
        {
            if (Input.GetButtonDown("Fire1") && (x == 3) && ammoMinigun > 0)
            {
                anim.SetBool("MinigunHeldDown", true);
                //  ammoOut = (int)ammoMinigun / 5;
                //    Debug.Log("Minigun");
                MP40Start();
                RaycastHit hit;
                //If statement if we hit something
                if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 200))
                {
                    EnemyAnimations target = hit.transform.GetComponent <EnemyAnimations>();
                    MP40(target);
                }
                minigunFiring = true;
            }

            if (Input.GetKey("mouse 0") && minigunFiring && ((ammoMinigun > 0 && x == 3) || (x == 4 && ammoMP > 0)))
            {
                anim.SetBool("MinigunHeldDown", true);
                RaycastHit hit;
                //If statement if we hit something
                if (x == 3)
                {
                    if (ammoMinigun > 0)
                    {
                        if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 200))
                        {
                            EnemyAnimations target = hit.transform.GetComponent <EnemyAnimations>();
                            MP40(target);
                        }
                    }
                }
                else if (x == 4)
                {
                    if (ammoMP > 0)
                    {
                        if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 200))
                        {
                            EnemyAnimations target = hit.transform.GetComponent <EnemyAnimations>();
                            Minigun(target);
                        }
                    }
                }
            }



            /////



            if (Input.GetKey("mouse 0") && (x == 4) && ammoMP > 0)
            {
                anim.SetBool("MinigunHeldDown", true);
                //   Debug.Log("Minigun");
                //  ammoOut = (int)ammoMinigun / 5;
                MinigunStart();
                RaycastHit hit;
                //If statement if we hit something
                if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 200))
                {
                    EnemyAnimations target = hit.transform.GetComponent <EnemyAnimations>();
                    Minigun(target);
                }
                minigunFiring = true;
            }

            //     if(Input.GetKey("mouse 0") && minigunFiring && ammoMP > 0)
            {
                //     anim.SetBool("MinigunHeldDown", true);
                //      RaycastHit hit;
                // /     //If statement if we hit something
                //      if (Physics.Raycast(camera.transform.position, camera.transform.forward, out hit, 200))
                {
                    //         EnemyAnimations target = hit.transform.GetComponent<EnemyAnimations>();
                    //         Minigun(target);
                }
            }

            if (Input.GetButtonUp("Fire1"))
            {
                //  ammoOut = (int)ammoMinigun / 5;
                anim.SetBool("MinigunHeldDown", false);
                minigunFiring = false;
                anim.SetTrigger("MinigunStopFiring");
                anim.SetTrigger("MP40StopFiring");
            }



            if (Input.GetKeyDown("2") && firing == false)
            {
                ammoOut = (int)ammoPistol;
                firing  = false;
                x       = 2;
                //   Debug.Log("Pistol");
                //    Animator anim = GetComponent<Animator>();
                anim.SetTrigger("SwitchPistol");
            }

            if (Input.GetKeyDown("4") && firing == false)
            {
                ammoOut = (int)ammoMP / 5;
                x       = 3;
                //     Debug.Log("MP40");
                //    Animator anim = GetComponent<Animator>();
                anim.SetTrigger("SwitchMP40");
            }

            if (Input.GetKeyDown("3") && firing == false)
            {
                ammoOut = (int)ammoMinigun / 10;
                firing  = false;
                x       = 4;
                //    Debug.Log("Minigun");
                //    Animator anim = GetComponent<Animator>();
                anim.SetTrigger("SwitchMinigun");
            }

            if (Input.GetKeyDown("1") && firing == false)
            {
                ammoOut = 1000000;
                //1 million
                firing = false;
                x      = 1;
                //    Debug.Log("Knife");
                //   Animator anim = GetComponent<Animator>();
                anim.SetTrigger("SwitchKnife");
            }
            if (Input.GetButtonDown("Fire1") && x == 2 && ammoPistol > 0)
            {
                ammoPistol--;
                //  damage = 60;
                //  range = 15;
                Gun();
            }


            if (Input.GetButtonDown("Fire1") && x == 1)
            {
                //   damage = 30;
                //   range = 1;
                Knife();
            }
        }
    }
コード例 #25
0
 private void Awake()
 {
     //_rigidbody = GetComponent<Rigidbody>();
     _enemyAnimations = GetComponent <EnemyAnimations>();
 }
コード例 #26
0
 public void Awake()
 {
     characterAnimations = GameObject.Find("PlayerMary").GetComponent <CharacterAnimations>();
     enemyAnimations     = GameObject.Find("PlayerEnemy").GetComponent <EnemyAnimations>();
 }
コード例 #27
0
 private void Start()
 {
     m_Health          = m_MaxHealth;
     m_EnemyAnimations = GetComponent <EnemyAnimations>();
 }
コード例 #28
0
 public Dark(EnemyAnimations enemyAnimations, Vector2 initialPosition)
 {
 }
コード例 #29
0
 private void Constructor(EventManager eventManager, EnemyAnimations enemyAnimations, PersonMover enemyMover)
 {
     _eventManager    = eventManager;
     _enemyAnimations = enemyAnimations;
     _personMover     = enemyMover;
 }