protected override void Execute()
 {
     if (hookProjectileRef.Get().CollidingGameObjects.Count != 0)
     {
         hookProjectileRef.Get().SetParent(hookProjectileRef.Get().CollidingGameObjects[0].transform);
     }
 }
 protected override void Execute()
 {
     hookRef.Get().AddAnchor(
         hookProjectileRef.Get().Transform.position,
         hookProjectileRef.Get().Transform
         );
 }
예제 #3
0
 protected override void Execute()
 {
     shootHookEvent.Dispatch(new ShootHookEvent.Parameter(
                                 weaponRef.Get().ShootDirection,
                                 weaponRef.Get().SpawnPosition
                                 ));
 }
 protected override void Execute()
 {
     if (playerVelocityRef.Get().Velocity != Vector2.zero || playerVelocityRef.Get().CurrentSpeed == 0)
     {
         Abort();
     }
 }
        public void ScanSky()
        {
            float     detectTime = GetDetectTime();
            KPrefabID component  = GetComponent <KPrefabID>();

            if ((Object)targetCraft.Get() == (Object)null)
            {
                if (SaveGame.Instance.GetComponent <SeasonManager>().TimeUntilNextBombardment() <= detectTime)
                {
                    component.AddTag(GameTags.Detecting, false);
                }
                else
                {
                    component.RemoveTag(GameTags.Detecting);
                }
            }
            else
            {
                Spacecraft spacecraftFromLaunchConditionManager = SpacecraftManager.instance.GetSpacecraftFromLaunchConditionManager(targetCraft.Get());
                if (spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Destroyed)
                {
                    targetCraft.Set(null);
                    component.RemoveTag(GameTags.Detecting);
                }
                else if (spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Launching || spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.WaitingToLand || spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Landing || (spacecraftFromLaunchConditionManager.state == Spacecraft.MissionState.Underway && spacecraftFromLaunchConditionManager.GetTimeLeft() <= detectTime))
                {
                    component.AddTag(GameTags.Detecting, false);
                }
                else
                {
                    component.RemoveTag(GameTags.Detecting);
                }
            }
        }
예제 #6
0
    private void CleanupLimboMinions()
    {
        KPrefabID component = GetComponent <KPrefabID>();

        if (component.InstanceID == -1)
        {
            DebugUtil.LogWarningArgs("Minion with an invalid kpid! Attempting to recover...", name);
            if ((UnityEngine.Object)KPrefabIDTracker.Get().GetInstance(component.InstanceID) != (UnityEngine.Object)null)
            {
                KPrefabIDTracker.Get().Unregister(component);
            }
            component.InstanceID = KPrefabID.GetUniqueID();
            KPrefabIDTracker.Get().Register(component);
            DebugUtil.LogWarningArgs("Restored as:", component.InstanceID);
        }
        if (component.conflicted)
        {
            DebugUtil.LogWarningArgs("Minion with a conflicted kpid! Attempting to recover... ", component.InstanceID, name);
            if ((UnityEngine.Object)KPrefabIDTracker.Get().GetInstance(component.InstanceID) != (UnityEngine.Object)null)
            {
                KPrefabIDTracker.Get().Unregister(component);
            }
            component.InstanceID = KPrefabID.GetUniqueID();
            KPrefabIDTracker.Get().Register(component);
            DebugUtil.LogWarningArgs("Restored as:", component.InstanceID);
        }
        assignableProxy.Get().SetTarget(this, base.gameObject);
    }
예제 #7
0
    protected override void Execute()
    {
        int levelNumber = LevelHelper.GetNumberOfLevelWithScene(sceneStatus.currentScene);

        if (!gameStateModel.Get().CompletedLevels.Contains(levelNumber))
        {
            gameStateModel.Get().CompletedLevels.Add(levelNumber);
        }
    }
예제 #8
0
    public void DestroyLevelObject()
    {
        bool isSelected = this == (Object)selectedLevelObjectRef.Get();

        selectedLevelObjectRef.Set(null);
        if (isSelected)
        {
            selectedLevelObjectStatusUpdatedEvent.Dispatch(this);
        }
        Destroy();
    }
예제 #9
0
 protected override void Execute(bool enable)
 {
     if (enable)
     {
         playerVelocityRef.Get().EnableDirectionalMovement();
     }
     else
     {
         playerVelocityRef.Get().DisableDirectionalMovement();
     }
 }
 protected override void Execute(bool enable)
 {
     if (enable)
     {
         playerTrailRef.Get().EnableTrail();
     }
     else
     {
         playerTrailRef.Get().DisableTrail();
     }
 }
예제 #11
0
 private IAssignableIdentity GetSavedAssignee()
 {
     if ((UnityEngine.Object)assignee_identityRef.Get() != (UnityEngine.Object)null)
     {
         return(assignee_identityRef.Get().GetComponent <IAssignableIdentity>());
     }
     if (assignee_groupID != string.Empty)
     {
         return(Game.Instance.assignmentManager.assignment_groups[assignee_groupID]);
     }
     return(null);
 }
    protected override void ExecuteOverTime(string prefabPath, CanvasLayer canvasLayer)
    {
        GameObject prefab = Resources.Load <GameObject>(prefabPath);

        if (prefab == null)
        {
            Debug.LogWarning("Can't instantiate view prefab as no prefab is found at given path '" + prefabPath + "'.", prefab);
            return;
        }

        GameObject child = canvasUIRef.Get().GetCanvasLayerChild(canvasLayer, prefabPath);

        canvasUIRef.Get().DestroyCanvasLayerChild(child, canvasLayer, prefabPath, Release);
    }
예제 #13
0
 public Vector3 GetPosition()
 {
     if ((Object)prefabId.Get() != (Object)null)
     {
         return(prefabId.Get().transform.GetPosition());
     }
     return(position);
 }
예제 #14
0
    private IEnumerator CheckAligningWithPosition(Vector2 cornerPosition)
    {
        Vector2 halfWorldScale        = VectorHelper.Abs(transform.localScale) / 2;
        Vector2 characterCornerOffset = VectorHelper.Multiply(halfWorldScale, playerVelocityRef.Get().MoveDirection);

        while (true)
        {
            Vector2 characterCornerPosition         = (Vector2)transform.position + characterCornerOffset;
            Vector2 offsetToCharacterCornerPosition = characterCornerPosition - cornerPosition;

            if (VectorHelper.VectorsAxisesHaveSameSigns(offsetToCharacterCornerPosition, cornerDirection))
            {
                if (OnAlignWithTarget != null)
                {
                    OnAlignWithTarget(cornerPosition);
                }
                break;
            }

            yield return(null);
        }

        currentTargetCornerTransform     = null;
        checkAligningWithTargetCoroutine = null;
    }
 protected override void Execute(int layer)
 {
     if (hookProjectileRef.Get().CollidingLayers.Contains(layer))
     {
         Abort();
     }
 }
예제 #16
0
 protected override void Execute(List <HookState> hookStates)
 {
     if (hookStates.Contains(hookRef.Get().ActiveHookState))
     {
         Abort();
     }
 }
 protected override void Execute(string tag)
 {
     if (!collision.transform.CompareTag(tag) && !playerTriggerHitDetectionRef.Get().HittingTriggerTags.Contains(tag))
     {
         Abort();
     }
 }
예제 #18
0
 protected override void Execute()
 {
     hookProjectileMoveTowardsRef.Get().StartMovingToTarget(
         weaponRef.Get().Owner.transform,
         hookProjectileReturnedToOwnerEvent
         );
 }
    protected override void Execute()
    {
        Vector2 worldPosition = levelEditorSwipeMovedOnWorldEventParameter.Position;
        Vector2 startOffset   = levelObjectTranslateStartOffsetStatus.StartOffset;

        selectedLevelObjectRef.Get().Translate(worldPosition + startOffset);
    }
 protected override void OnSpawn()
 {
     base.OnSpawn();
     UpdateTint();
     UpdateStatusString();
     base.OnAssign += OnNewAssignment;
     if (assignee == null)
     {
         MinionStorage component = GetComponent <MinionStorage>();
         if ((bool)component)
         {
             List <MinionStorage.Info> storedMinionInfo = component.GetStoredMinionInfo();
             if (storedMinionInfo.Count > 0)
             {
                 MinionStorage.Info info             = storedMinionInfo[0];
                 Ref <KPrefabID>    serializedMinion = info.serializedMinion;
                 if (serializedMinion != null && serializedMinion.GetId() != -1)
                 {
                     KPrefabID            kPrefabID  = serializedMinion.Get();
                     StoredMinionIdentity component2 = kPrefabID.GetComponent <StoredMinionIdentity>();
                     component2.ValidateProxy();
                     Assign(component2);
                 }
             }
         }
     }
 }
예제 #21
0
 protected override void Execute()
 {
     if (playerCollisionDirectionRef.Get().CollisionDirection != Vector2.zero)
     {
         Abort();
     }
 }
    protected override void Execute()
    {
        LevelSelectButtonView prefab = Resources.Load <LevelSelectButtonView>(LEVEL_SELECT_BUTTON_PREFAB_PATH);

        if (prefab == null)
        {
            Debug.LogWarning("Can't instantiate LevelEditorLevelSelectButtonView prefab as no prefab is found at given path '" + LEVEL_SELECT_BUTTON_PREFAB_PATH + "'.");
            return;
        }

        if (!Directory.Exists(LevelDataPath.Path))
        {
            return;
        }

        DirectoryInfo info = new DirectoryInfo(LevelDataPath.Path);

        FileInfo[] filesInfo = info.GetFiles();
        foreach (FileInfo fileInfo in filesInfo)
        {
            LevelSelectButtonView levelEditorLevelSelectButtonView = context.InstantiateView(prefab);
            levelEditorLevelSelectButtonView.transform.SetParent(levelEditorLevelSelectGridLayoutGroupRef.Get().Transform);

            string levelName = StringHelper.RevertXMLCompatible(fileInfo.Name);
            levelEditorLevelSelectButtonView.SetButtonName(levelName);
        }
    }
    protected override void Execute()
    {
        IHook          hook          = hookRef.Get();
        IGrapplingHook grapplingHook = grapplingHookRef.Get();
        Vector2        ownerPosition = weaponRef.Get().Owner.transform.position;

        RaycastHit2D hitToAnchor = Physics2D.Linecast(ownerPosition, hook.Anchors[0].position, hook.RopeRaycastLayerMask);

        if (hitToAnchor.collider != null)
        {
            Vector2 anchorPosition = hitToAnchor.point + (ownerPosition - hitToAnchor.point).normalized * 0.1f;
            addHookAnchorEvent.Dispatch(anchorPosition, hitToAnchor.transform);
            grapplingHook.DistanceJoint.distance = Vector2.Distance(ownerPosition, hitToAnchor.point);
        }
        else if (hook.Anchors.Count > 1)
        {
            RaycastHit2D hitToPreviousAnchor = Physics2D.Linecast(ownerPosition, hook.Anchors[1].position, hook.RopeRaycastLayerMask);
            if (hitToPreviousAnchor.collider == null)
            {
                grapplingHook.DistanceJoint.distance = Vector2.Distance(ownerPosition, hook.Anchors[0].position) + Vector2.Distance(hook.Anchors[0].position, hook.Anchors[1].position);
                hook.DestroyAnchorAt(0);
            }
        }

        grapplingHook.DistanceJoint.connectedAnchor = hook.Anchors[0].position;
    }
예제 #24
0
 protected override void Execute()
 {
     if (hookProjectileRef.Get().CollidingLayers.Count == 0)
     {
         Abort();
     }
 }
 protected override void Execute()
 {
     if (playerSlidingRef.Get().CurrentTargetCornerTransform != collider.transform)
     {
         Abort();
     }
 }
예제 #26
0
 protected override void Execute()
 {
     if (playerCollisionDirectionRef.Get().SavedCollisionsCount > 1)
     {
         Abort();
     }
 }
예제 #27
0
 protected override void Execute(HookState hookState)
 {
     if (hookRef.Get().LastHookState == hookState)
     {
         Abort();
     }
 }
예제 #28
0
 protected override void Execute()
 {
     if (touchInput.Get().SwipeDelta2FingersBiggerThenPinchDelta)
     {
         Abort();
     }
 }
 protected override void Execute()
 {
     if (!playerDieRef.Get().DeadlyTags.Contains(collision.transform.tag))
     {
         Abort();
     }
 }
예제 #30
0
 protected override void Execute(string prefabPath, CanvasLayer canvasLayer)
 {
     if (!canvasUIRef.Get().ContainsCanvasLayerChild(canvasLayer, prefabPath))
     {
         Abort();
     }
 }