예제 #1
0
        private void FireGuns()
        {
            GameObject targetLeft  = m_LeftEye.Fire();
            GameObject targetRight = m_RightEye.Fire();

            Management.MutrixGame.instance.ShotMade();

            // Same target?
            if ((targetLeft != null && targetRight != null) && targetLeft == targetRight)
            {
                WorldObject left  = targetLeft.GetComponent <WorldObject>();
                WorldObject right = targetRight.GetComponent <WorldObject>();
                if (left == null || right == null)
                {
                    // Shot structure
                    ChangeState(State.Shooting);
                    m_LeftEye.ShootHit();
                    m_RightEye.ShootHit();
                }
                // Connect! Targets arent in same world yet
                else if (!left.IsBoth() && !right.IsBoth())
                {
                    ChangeState(State.ShootingConnected);
                    left.ChangeType(WorldObject.Type.Both);
                    right.ChangeType(WorldObject.Type.Both);
                    m_LeftEye.ShootConnected();
                    m_RightEye.ShootConnected();
                }
                else
                {
                    //Already in both worlds
                    ChangeState(State.Shooting);
                    m_LeftEye.ShootHit();
                    m_RightEye.ShootHit();
                }
            }
            else
            {
                if (targetLeft == null)
                {
                    ChangeState(State.Shooting);
                    m_LeftEye.ShootMiss();
                }
                else
                {
                    ChangeState(State.Shooting);
                    m_LeftEye.ShootHit();
                }

                if (targetRight == null)
                {
                    ChangeState(State.Shooting);
                    m_RightEye.ShootMiss();
                }
                else
                {
                    ChangeState(State.Shooting);
                    m_RightEye.ShootHit();
                }
            }
        }