예제 #1
0
    //public bool IsLocked = false;
    //public string TempLockedTargetID;

    public static void CheckComplitionMoveInDream(ModelNPC.GameDataAlien dataNPC)
    {
        //TEST
        if (dataNPC.IsReality)
        {
            Debug.Log(Storage.EventsUI.ListLogAdd = "### CheckComplitionMoveInDream dataNPC IsReality !!!");
            return;
        }

        Vector3 newCurrentPosition = GetAlienData(dataNPC).Position;// .MovePosition;
        float   dist = Vector3.Distance(dataNPC.TargetPosition, newCurrentPosition);
        //string nameFiledTarget = Helper.GetNameField(dataNPC.TargetPosition);
        //string nameFiledCurrent = Helper.GetNameField(newCurrentPosition);
        string nameFiledTarget  = Helper.GetNameFieldPosit(dataNPC.TargetPosition.x, dataNPC.TargetPosition.y);
        string nameFiledCurrent = Helper.GetNameFieldPosit(newCurrentPosition.x, newCurrentPosition.y);

        //End move to Target
        bool trueDist  = dist < MinDistEndMove;
        bool trueField = nameFiledTarget == nameFiledCurrent;

        if (trueDist || trueField)
        {
            //@JOB@
            if (AlienJobsManager.CheckJobAlien(dataNPC) == false)
            {
                RequestActionNPC(dataNPC, NameActionsPerson.Idle, null);
            }
        }
    }
예제 #2
0
 public static void CheckComplitionLoot(ModelNPC.GameDataAlien dataNPC, GameActionPersonController controller)
 {
     //if (AlienJobsManager.CheckJobAlien(dataNPC) == false)
     if (AlienJobsManager.CheckJobAlien(dataNPC, isCheckDistance: false) == false)
     {
         RequestActionNPC(dataNPC, NameActionsPerson.Target, controller);
     }
 }
예제 #3
0
    private void CheckComplitionMove()
    {
        if (m_dataNPC == null || m_MeMovement == null || m_MeAnimation == null)
        {
            return;
        }

        Vector3 targetPosition = m_dataNPC.TargetPosition;

        m_MeMovement = targetPosition - transform.position;
        if (m_MeMovement != new Vector2())
        {
            if (m_MeMovement.x != 0)
            {
                bool isRight = m_MeMovement.x > 0;
                //<<ANIMATION>>
                m_MeAnimation.PersonLook(isRight);
            }
        }

        bool isCompletedMoving = false;

        isCompletedMoving = TestMoveTargetLock();
        if (isCompletedMoving) //LOCK
        {
            RequestActionNPC(m_dataNPC, NameActionsPerson.IdleLock, this);
            int colWay = UnityEngine.Random.Range(1, 4);
            foreach (int i in Enumerable.Range(0, colWay))
            {
                RequestActionNPC(m_dataNPC, NameActionsPerson.TargetLocal, this);
            }
            RequestActionNPC(m_dataNPC, NameActionsPerson.TargetBackToBase, this);
        }
        else
        {
            //test on Structure //!FIX MOVE TARGET!
            bool p_isLarge = IsValidLargeLock(false);

            //float dist = Vector3.Distance(targetPosition, transform.position);
            //isCompletedMoving = dist < MinDistEndMove;
            //if (isCompletedMoving) //END WAY TO BASE TARGET
            if (Helper.DistanceIsFinish(targetPosition, transform.position, p_isLarge))
            {
                //@JOB@
                if (AlienJobsManager.CheckJobAlien(m_dataNPC, this, false) == false)
                {
                    RequestActionNPC(m_dataNPC, NameActionsPerson.Idle, this);
                    RequestActionNPC(m_dataNPC, NameActionsPerson.Target, this);
                }
                isCompletedMoving = true;
            }
        }

        bool isAnimateMove = (ActionPerson == NameActionsPerson.Move) && isCompletedMoving == false;

        //<<ANIMATION>>
        if (m_MeAnimation != null)
        {
            m_MeAnimation.PersonMove(isAnimateMove);
        }
    }