Esempio n. 1
0
        public virtual TaskStatus OnUpdate()
        {
            NavMeshAgent    navMeshAgent        = this.Agent.NavMeshAgent;
            OffMeshLinkData nextOffMeshLinkData = navMeshAgent.get_nextOffMeshLinkData();
            OffMeshLink     offMeshLink         = ((OffMeshLinkData) ref nextOffMeshLinkData).get_offMeshLink();

            if (!Object.op_Inequality((Object)offMeshLink, (Object)null))
            {
                return((TaskStatus)1);
            }
            if (Object.op_Inequality((Object)offMeshLink.get_startTransform(), (Object)null))
            {
                navMeshAgent.SetDestination(offMeshLink.get_startTransform().get_position());
                return((TaskStatus)2);
            }
            Debug.LogError((object)"オフメッシュリンクにstartTransformが設定されてない", (Object)((Component)offMeshLink).get_gameObject());
            return((TaskStatus)1);
        }
        /// <summary>
        /// Manage all Off Mesh Links
        /// </summary>
        protected virtual void CheckOffMeshLinks()
        {
            if (Agent.isOnOffMeshLink && !EnterOFFMESH)                         //Check if the Agent is on a OFF MESH LINK
            {
                EnterOFFMESH = true;                                            //Just to avoid entering here again while we are on a OFF MESH LINK
                OffMeshLinkData OMLData = Agent.currentOffMeshLinkData;

                if (OMLData.linkType == OffMeshLinkType.LinkTypeManual)                 //Means that it has a OffMesh Link component
                {
                    OffMeshLink CurrentOML = OMLData.offMeshLink;                       //Check if the OffMeshLink is a Manually placed  Link

                    ActionZone Is_a_OffMeshZone =
                        CurrentOML.GetComponentInParent <ActionZone>();                 //Search if the OFFMESH IS An ACTION ZONE (EXAMPLE CRAWL)

                    if (Is_a_OffMeshZone && !DoingAnAction)                             //if the OffmeshLink is a zone and is not making an action
                    {
                        animal.Action = DoingAnAction = true;                           //Activate the Action on the Animal
                        return;
                    }


                    var DistanceEnd   = (transform.position - CurrentOML.endTransform.position).sqrMagnitude;
                    var DistanceStart = (transform.position - CurrentOML.startTransform.position).sqrMagnitude;

                    var NearTransform = DistanceEnd < DistanceStart ? CurrentOML.endTransform : CurrentOML.startTransform;
                    var FarTransform  = DistanceEnd > DistanceStart ? CurrentOML.endTransform : CurrentOML.startTransform;
                    StartCoroutine(MalbersTools.AlignTransform_Rotation(transform, NearTransform.rotation, 0.15f)); //Aling the Animal to the Link Position

                    if (animal.canFly && CurrentOML.CompareTag("Fly"))
                    {
                        Debuging(name + ": Fly OffMesh");
                        StartCoroutine(CFlyOffMesh(FarTransform));
                    }
                    else if (CurrentOML.area == 2)
                    {
                        animal.SetJump();                         //if the OffMesh Link is a Jump type
                    }
                }
                else if (OMLData.linkType == OffMeshLinkType.LinkTypeJumpAcross)             //Means that it has a OffMesh Link component
                {
                    animal.SetJump();
                }
            }
        }
        void DoGetCurrentOffMeshLinkGameObject()
        {
            if (_agent == null)
            {
                return;
            }

            if (!_agent.isOnOffMeshLink)
            {
                return;
            }

            OffMeshLink comp = _agent.currentOffMeshLinkData.offMeshLink;            // .GetCurrentOffMeshLinkGameObject();

            if (comp != null)
            {
                storeOffMeshLinkGameObject.Value = comp.gameObject;
            }
        }
Esempio n. 4
0
 public override void GuestAction()
 {
     base.GuestAction();
     Collider[] _colLink = Physics.OverlapSphere(transform.position, 0.5f);
     for (int i = 0; i < _colLink.Length; i++)
     {
         try
         {
             offLink = _colLink[i].transform.parent.GetComponent <OffMeshLink>();
             if (offLink != null)
             {
                 ClimbSetting();
                 Debug.Log("설정완료");
                 StartCoroutine(Climbing());
                 break;
             }
         }
         catch { };
     }
 }
Esempio n. 5
0
        public bool ElevatorOnPath(OffMeshLink link)
        {
            Elevator.MeshLinkDetector check = null;

            if (link != null)
            {
                check = link.GetComponent <Elevator.MeshLinkDetector>();
            }
            else
            {
                Debug.Log(link);
            }

            if (check != null)
            {
                return(true);
            }

            return(false);
        }
Esempio n. 6
0
        public void GetElevatorInformation(Squad.Core core, OffMeshLink link, Vector3 startPos)
        {
            Elevator.Elevator mainPart = link.GetComponent <Elevator.MeshLinkDetector>().main;
            core.mainPart = mainPart;

            if (link.startTransform.position == startPos)
            {
                core.entry = GetLevel(mainPart, link.startTransform.position);
                core.exit  = GetLevel(mainPart, link.endTransform.position);
            }
            else
            {
                core.entry = GetLevel(mainPart, link.endTransform.position);
                core.exit  = GetLevel(mainPart, link.startTransform.position);
            }

            if (core.entry != core.exit || mainPart != null)
            {
                core.toUseElevator = true;
            }
        }
 // Update is called once per frame
 void Update()
 {
     if (heroAgent.hasPath)
     {
         transform.LookAt(heroAgent.nextPosition);
         aniString = "run";
         heroAnimation.wrapMode = WrapMode.Loop;
         if (heroAgent.isOnOffMeshLink)
         {
             OffMeshLink link = heroAgent.currentOffMeshLinkData.offMeshLink;
             if (link.name == "UpLine")
             {
                 aniString = "jump";
             }
             else if (link.name == "DownLine")
             {
                 aniString = "casting";
             }
             lerpStart = link.startTransform.position;
             lerpEnd   = link.endTransform.position;
             lerpBool  = true;
             lerpRatio = Time.time;
         }
     }
     else
     {
         aniString = "hit1";
         heroAnimation.wrapMode = WrapMode.Once;
     }
     // 动画播放器 播放动画
     heroAnimation.Play(aniString);
     if (lerpBool)
     {
         transform.position = Vector3.Lerp(lerpStart, lerpEnd, (Time.time - lerpRatio) * 2);
         if (transform.position == lerpEnd)
         {
             lerpBool = false;
         }
     }
 }
Esempio n. 8
0
    // 檢查是否可移動的這格
    public bool CheckNextMove(EDirection _direction, int _cost)
    {
        OffMeshLink offMeshLink = m_MoveDirection[(int)_direction];

        if (!offMeshLink)
        {
            Debug.LogError("沒有OffMeshLink請檢查: " + gameObject.name);
            return(false);
        }

        if (offMeshLink.endTransform != null)
        {
            return(false);
        }

        if (_cost > m_Cost)
        {
            return(false);
        }

        return(true);
    }
Esempio n. 9
0
        private void CreateAIPoints()
        {
            if (link)
            {
                return;
            }

            link = gameObject.AddComponent <OffMeshLink>();

            GameObject goStart = new GameObject("AIStartPoint");

            goStart.transform.SetParent(transform);
            goStart.transform.localPosition = Vector3.zero;

            GameObject goEnd = new GameObject("AIEndPoint");

            goEnd.transform.SetParent(transform);
            goEnd.transform.localPosition = endPoint ? endPoint.localPosition : Vector3.up;

            link.startTransform = goStart.transform;
            link.endTransform   = goEnd.transform;
        }
Esempio n. 10
0
    static int set_autoUpdatePositions(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name autoUpdatePositions");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index autoUpdatePositions on a nil value");
            }
        }

        OffMeshLink obj = (OffMeshLink)o;

        obj.autoUpdatePositions = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
Esempio n. 11
0
    static int get_occupied(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name occupied");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index occupied on a nil value");
            }
        }

        OffMeshLink obj = (OffMeshLink)o;

        LuaScriptMgr.Push(L, obj.occupied);
        return(1);
    }
Esempio n. 12
0
    static int set_navMeshLayer(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name navMeshLayer");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index navMeshLayer on a nil value");
            }
        }

        OffMeshLink obj = (OffMeshLink)o;

        obj.navMeshLayer = (int)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Esempio n. 13
0
    static int set_costOverride(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name costOverride");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index costOverride on a nil value");
            }
        }

        OffMeshLink obj = (OffMeshLink)o;

        obj.costOverride = (float)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Esempio n. 14
0
    static int set_endTransform(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name endTransform");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index endTransform on a nil value");
            }
        }

        OffMeshLink obj = (OffMeshLink)o;

        obj.endTransform = LuaScriptMgr.GetNetObject <Transform>(L, 3);
        return(0);
    }
Esempio n. 15
0
    /// <summary>
    /// 1. 벽 다 오르면 위치 이동시키기
    /// 2. 상태 돌려주기
    /// 3. 바로 움직일 수 있게 해주기
    /// </summary>
    /// <param name="_pos"></param>
    public override void EndState(Vector3 _pos)
    {
        base.EndState(_pos);

        isAction = false;

        if (cNetworkIdentity.isHost)
        {
            nav.isStopped = false;
            nav.CompleteOffMeshLink();
            offLink.activated    = true;
            offLink.costOverride = -1;
            offLink       = null;
            aiCon.offLink = null;
            networkAITransmitor.EndFullAction();
            aiCon.EndActionCheckState(AIController.AIState.LAND);
        }
        else
        {
            //NavMeshHit hit;
            //nav.SamplePathPosition(groundLayer, 2f, out hit);
            //nav.nextPosition = hit.position;
            Debug.Log(offLink.endTransform.position);
            nav.enabled      = true;
            nav.nextPosition = offLink.endTransform.position;
            //nav.CompleteOffMeshLink();
            Debug.Log("뛰어내리기 끝 처리");
            offLink.activated    = true;
            offLink.costOverride = -1;
            offLink       = null;
            aiCon.offLink = null;
            CAIPacket _aiPacket = networkAISyncor.GetSyncInfo();
            _aiPacket.DeFlagAction();
            networkAISyncor.CheckSyncEnd(_aiPacket);
            networkAISyncor.EndFullAction();
        }
    }
Esempio n. 16
0
    private IEnumerator HandleOffMeshLink()
    {
        while (true)
        {
            if (m_agent.isOnOffMeshLink)
            {
                OffMeshLinkData data = m_agent.currentOffMeshLinkData;
                OffMeshLink     link = data.offMeshLink;
                link.costOverride += 1;

                Collider[] hitColliders = Physics.OverlapSphere(transform.position, 5);
                foreach (Collider col in hitColliders)
                {
                    UnitController unit = col.GetComponent <UnitController>();
                    if (null != unit && !unit.GetAgent().isOnOffMeshLink&&
                        link.Equals(unit.GetAgent().nextOffMeshLinkData.offMeshLink))
                    {
                        unit.RecalculatePathUnit();
                    }
                }

                while (m_agent.transform.position != data.endPos)
                {
                    m_agent.transform.position = Vector3.MoveTowards(m_agent.transform.position, data.endPos, m_agent.speed * Time.deltaTime);
                    yield return(null);
                }

                if (m_agent.isOnNavMesh)
                {
                    m_agent.CompleteOffMeshLink();
                }

                link.costOverride -= 1;
            }
            yield return(null);
        }
    }
Esempio n. 17
0
    private void OnDrawGizmos()
    {
        if (m_Link == null)
        {
            m_Link = GetComponent <OffMeshLink>();
        }

        if (m_Link.startTransform != null)
        {
            Gizmos.color = Color.green;
            Gizmos.DrawCube(m_Link.startTransform.position, Vector3.one * 0.2f);
        }

        if (m_Link.endTransform != null)
        {
            Gizmos.color = Color.red;
            Gizmos.DrawCube(m_Link.endTransform.position, Vector3.one * 0.2f);
        }

        if (m_Link.endTransform != null && m_Link.startTransform != null)
        {
            Debug.DrawLine(m_Link.endTransform.position, m_Link.startTransform.position, Color.red);
        }
    }
Esempio n. 18
0
    public override void GuestAction()
    {
        base.GuestAction();

        Collider[] _colLink = Physics.OverlapSphere(transform.position, 0.5f);
        for (int i = 0; i < _colLink.Length; i++)
        {
            try
            {
                offLink = _colLink[i].transform.parent.GetComponent <OffMeshLink>();
                if (offLink != null && offLink.CompareTag("Cliff"))
                {
                    Debug.Log("컴포넌트:" + _colLink[i].transform.parent.name);
                    Debug.Log(offLink.startTransform.position + "," + offLink.endTransform.position);
                    nav.autoTraverseOffMeshLink = false;
                    nav.enabled = false;
                    isAction    = true;
                    StartCoroutine(Cliffing());
                    break;
                }
            }
            catch { };
        }
    }
Esempio n. 19
0
 private void Start()
 {
     health    = GetComponent <Health>();
     uIManager = FindObjectOfType <UIManager>();
     link      = GetComponent <OffMeshLink>();
 }
Esempio n. 20
0
    protected override IEnumerator chooseRoamingDest() //TODO: Fix bug where doctor always targets NavEnd instead of one furthest away from him
    {
        isChoosingDest = true;
        yield return(new WaitForSeconds(1f));

        List <Transform> closestDoors = new List <Transform>();
        List <Transform> doorsInRange = detectDoors.doorsInRange;

        foreach (Transform door in doorsInRange) //Cannot use previous doors
        {
            if (!prevDoors.Contains(door))
            {
                Debug.Log("ADDING " + door.gameObject.name);
                closestDoors.Add(door);
            }
        }
        closestDoors = sortByClosestFirst(closestDoors); //Sort doors in range by closest first to establish priority
        if (closestDoors.Count > 2)
        {
            closestDoors.RemoveRange(2, closestDoors.Count - 2); //Use only the 2 closest doors
        }
        foreach (Transform door in prevDoors)
        {
            Debug.Log("PREVIOUS DOOR: " + door.gameObject.GetInstanceID());
        }
        foreach (Transform door in doorsInRange)
        {
            Debug.Log("DOORSINRANGE: " + door.gameObject.GetInstanceID());
        }
        prevDoors = new List <Transform>();
        foreach (Transform door in closestDoors)
        {
            prevDoors.Add(door);
        }
        for (int i = 0; i < 2; i++)
        {
            Transform closestDoor = getClosestDoor(closestDoors);
            Debug.Log("CLOSEST DOOR: " + closestDoor.gameObject.name);
            SlidingDoor doorScript = closestDoor.gameObject.GetComponent <SlidingDoor>();
            //Set dest to door, go thru door, remove door from closest doors array, repeat 1 more time
            OffMeshLink closestDoorLink = closestDoor.GetComponent <OffMeshLink>();
            Transform[] startAndEnd     = { closestDoorLink.startTransform, closestDoorLink.endTransform };
            furthestPoint = getFurthestNav(startAndEnd);
            enemyNav.SetDestination(furthestPoint.position + (-furthestPoint.transform.right * 2));
            if (i == 0 && closestDoors.Count > 1)
            {
                bool enemyHasReachedDest = false;
                while (!enemyHasReachedDest)
                {
                    if (!enemyNav.pathPending)
                    {
                        if (enemyNav.remainingDistance <= enemyNav.stoppingDistance)
                        {
                            if (!enemyNav.hasPath || enemyNav.velocity.sqrMagnitude == 0f)
                            {
                                enemyHasReachedDest = true;
                                Debug.Log("Doctor has reached dest");
                            }
                        }
                    }
                    yield return(null);
                }
                while (enemyNav.isOnOffMeshLink)
                {
                    if (!enemyNav.isOnOffMeshLink)
                    {
                        Debug.Log("Doctor has stopped off mesh link");
                        break;
                    }
                    yield return(null);
                }
                closestDoors.Remove(closestDoor);
            }
        }
        isChoosingDest = false;
    }
Esempio n. 21
0
 private void Awake()
 {
     GameMediator.RegisterWindow(this);
     m_navLink         = GetComponent <OffMeshLink>();
     m_navLink.enabled = true;
 }
Esempio n. 22
0
 // Use this for initialization
 void Start()
 {
     oof         = GetComponent <OffMeshLink>();
     isTriggered = false;
 }
Esempio n. 23
0
    void Start()
    {
        NavMeshAgent agent = new NavMeshAgent();

        ofl = GetComponent <OffMeshLink>();
    }
Esempio n. 24
0
 void Start()
 {
     animator = GetComponent <Animator> ();
     link     = GetComponent <OffMeshLink> ();
     animator.Stop();
 }
        /// <summary>
        /// Manage all Off Mesh Links
        /// </summary>
        protected virtual void CheckOffMeshLinks()
        {
            if (isFlying)
            {
                return;
            }

            if (Agent.isOnOffMeshLink)
            {
                OffMeshLinkData CurrentOffmeshLink_Data = Agent.currentOffMeshLinkData;

                OffMeshLink CurrentOffMeshLink = CurrentOffmeshLink_Data.offMeshLink;       //Check if the OffMeshLink is a Custom Off Mesh Link
                ActionZone  OffMeshZone        = null;

                if (CurrentOffMeshLink)                                                     //Checking if the OffMeshLink is an Action Zone
                {
                    OffMeshZone = CurrentOffMeshLink.GetComponentInChildren <ActionZone>();
                    if (!OffMeshZone)
                    {
                        OffMeshZone = CurrentOffMeshLink.GetComponentInParent <ActionZone>();
                    }
                }

                if (OffMeshZone)
                {
                    if (!StartingAction)        //If the Target is an Action Zone Start the Action
                    {
                        StartingAction = true;
                        animal.Action  = true;                          //Activate the Action on the Animal
                        return;
                    }
                }

                if (CurrentOffmeshLink_Data.linkType == OffMeshLinkType.LinkTypeManual) //Means that it has a OffMesh Link component
                {
                    Transform NearTransform = CurrentOffMeshLink.startTransform;

                    if (CurrentOffMeshLink.endTransform.position == CurrentOffmeshLink_Data.startPos) //Verify the start point of the OffMeshLink
                    {
                        NearTransform = CurrentOffMeshLink.endTransform;
                    }

                    StartCoroutine(MalbersTools.AlignTransformsC(transform, NearTransform, 0.5f, false, true)); //Aling the Animal to the Link

                    try
                    {
                        if (CurrentOffMeshLink.CompareTag("Fly"))
                        {
                            animal.SetFly(true);
                            isFlying = true;

                            StartCoroutine(FlyTowardsTarget(CurrentOffMeshLink.endTransform));
                            return;
                        }
                    }
                    catch
                    { /*Debug.LogWarning("There's no Fly Tag");*/ }

                    if (CurrentOffMeshLink.area == 2)                          //if the OffMesh Link is a Jump type
                    {
                        animal.SetJump();
                    }
                }
            }
        }
Esempio n. 26
0
        protected override void InitSub()
        {
            this._offMeshLink  = (OffMeshLink)((Component)this).GetComponent <OffMeshLink>();
            this.DoorAnimation = (DoorAnimation)((Component)this).GetComponent <DoorAnimation>();
            CommonDefine.CommonIconGroup icon          = Singleton <Resources> .Instance.CommonDefine.Icon;
            EventType playerEventMask                  = Singleton <Resources> .Instance.DefinePack.MapDefines.PlayerEventMask;
            List <CommandLabel.CommandInfo> toRelease1 = ListPool <CommandLabel.CommandInfo> .Get();

            List <CommandLabel.CommandInfo> toRelease2 = ListPool <CommandLabel.CommandInfo> .Get();

            foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.LabelTable)
            {
                KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                DoorPoint doorPoint = this;
                if (this._playerEventType.Contains(pair.Key) && playerEventMask.Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _))
                {
                    ActionPointInfo actionPointInfo = this._playerInfos.Find((Predicate <ActionPointInfo>)(x => x.eventTypeMask == pair.Key));
                    string          actionName      = actionPointInfo.actionName;
                    Sprite          sprite;
                    Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(actionPointInfo.iconID, out sprite);

                    Transform transform = ((Component)this).get_transform().FindLoop(actionPointInfo.labelNullName)?.get_transform() ?? ((Component)this).get_transform();
                    if (pair.Key == EventType.DoorOpen)
                    {
                        toRelease1.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                    else if (pair.Key == EventType.DoorClose)
                    {
                        toRelease2.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                }
            }
            this._openingLabels = toRelease1.ToArray();
            this._closingLabels = toRelease2.ToArray();
            ListPool <CommandLabel.CommandInfo> .Release(toRelease1);

            ListPool <CommandLabel.CommandInfo> .Release(toRelease2);

            List <CommandLabel.CommandInfo> toRelease3 = ListPool <CommandLabel.CommandInfo> .Get();

            List <CommandLabel.CommandInfo> toRelease4 = ListPool <CommandLabel.CommandInfo> .Get();

            foreach (KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > keyValuePair in ActionPoint.SickLabelTable)
            {
                KeyValuePair <EventType, Tuple <int, string, System.Action <PlayerActor, ActionPoint> > > pair = keyValuePair;
                DoorPoint doorPoint = this;
                if (this._playerEventType.Contains(pair.Key) && AIProject.Definitions.Action.NameTable.TryGetValue(pair.Key, out ValueTuple <int, string> _))
                {
                    ActionPointInfo actionPointInfo = this._playerInfos.Find((Predicate <ActionPointInfo>)(x => x.eventTypeMask == pair.Key));
                    string          actionName      = actionPointInfo.actionName;
                    Sprite          sprite;
                    Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(actionPointInfo.iconID, out sprite);

                    Transform transform = ((Component)this).get_transform().FindLoop(actionPointInfo.labelNullName)?.get_transform() ?? ((Component)this).get_transform();
                    if (pair.Key == EventType.DoorOpen)
                    {
                        toRelease3.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                    else if (pair.Key == EventType.DoorClose)
                    {
                        toRelease4.Add(new CommandLabel.CommandInfo()
                        {
                            Text             = actionName,
                            Icon             = sprite,
                            IsHold           = false,
                            TargetSpriteInfo = icon.ActionSpriteInfo,
                            Transform        = transform,
                            Event            = (System.Action)(() => pair.Value.Item3(Singleton <Manager.Map> .Instance.Player, (ActionPoint)doorPoint))
                        });
                        if (actionPointInfo.doorOpenType > -1)
                        {
                            this._openType = (DoorPoint.OpenTypeState)actionPointInfo.doorOpenType;
                        }
                    }
                }
            }
            this._sickOpeningLabels = toRelease3.ToArray();
            this._sickClosingLabels = toRelease4.ToArray();
            ListPool <CommandLabel.CommandInfo> .Release(toRelease3);

            ListPool <CommandLabel.CommandInfo> .Release(toRelease4);
        }
Esempio n. 27
0
 private void Start()
 {
     link = GetComponent <OffMeshLink>();
     link.UpdatePositions();
     InvokeRepeating("UpdateLinkPositions", 0f, 0.5f);
 }