void OnTriggerEnter2D(Collider2D col)
        {
            if (col.gameObject.tag.Equals(EnemyAWConst.ENEMY))
            {
                EnemyMoveAutoScript MoveAutoScript = col.gameObject.GetComponent <EnemyMoveAutoScript>();

                if (MoveAutoScript != null)
                {
                    if (Patrol)
                    {
                        if (MoveAutoScript.Patrol)
                        {
                            if (ComeFrom.Equals(ConfigSide.LEFT) && MoveAutoScript.facingRight)
                            {
                                MoveAutoScript.DoEnemyStatePointAction(Jump_Up, Jump_Forward, Move_Forward, Move_DirectionChange);
                            }
                            else if (ComeFrom.Equals(ConfigSide.RIGHT) && !MoveAutoScript.facingRight)
                            {
                                MoveAutoScript.DoEnemyStatePointAction(Jump_Up, Jump_Forward, Move_Forward, Move_DirectionChange);
                            }
                            else if (ComeFrom.Equals(ConfigSide.ALWAYS))
                            {
                                MoveAutoScript.DoEnemyStatePointAction(Jump_Up, Jump_Forward, Move_Forward, Move_DirectionChange);
                            }
                        }
                    }
                    else
                    {
                        if (!MoveAutoScript.Patrol)
                        {
                            if (ComeFrom.Equals(ConfigSide.LEFT) && MoveAutoScript.facingRight)
                            {
                                MoveAutoScript.DoEnemyStatePointAction(Jump_Up, Jump_Forward, Move_Forward, Move_DirectionChange);
                            }
                            else if (ComeFrom.Equals(ConfigSide.RIGHT) && !MoveAutoScript.facingRight)
                            {
                                MoveAutoScript.DoEnemyStatePointAction(Jump_Up, Jump_Forward, Move_Forward, Move_DirectionChange);
                            }
                            else if (ComeFrom.Equals(ConfigSide.ALWAYS))
                            {
                                MoveAutoScript.DoEnemyStatePointAction(Jump_Up, Jump_Forward, Move_Forward, Move_DirectionChange);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void FixGameObjectPosition(Collider2D col, bool triggerEnabled)
        {
            // Der Player darf nicht durch die Seitenwände springen
            if (col.gameObject.tag.Equals(EnemyAWConst.PLAYER))
            {
                MyPlayerController cont = col.gameObject.GetComponent <MyPlayerController>();
                cont.PlayerPolygonCollider.isTrigger = triggerEnabled;
            }

            if (LayerMask.LayerToName(col.gameObject.layer).Equals(EnemyAWConst.ENEMY))
            {
                if (!col.gameObject.tag.Equals(EnemyAWConst.ENEMY_BOUNCING))
                {
                    EnemyMoveAutoScript cont = col.gameObject.GetComponent <EnemyMoveAutoScript>();
                    cont.EnemyTriggerCollider.isTrigger = triggerEnabled;
                }
            }
        }
Exemplo n.º 3
0
 void Awake()
 {
     enemyMoveAutoScript = gameObject.GetComponent <EnemyMoveAutoScript> ();
     anim = gameObject.GetComponent <Animator> ();
 }