コード例 #1
0
        private void OnForceAdd(object sender, EventArgs e)
        {
            var selected = hero.Player.Selection.FirstOrDefault() as Unit;

            if (selected == null || !selected.IsControllable || selected is Hero)
            {
                return;
            }

            var controllable = controllableUnits.FirstOrDefault(x => x.Handle == selected.Handle);

            if (controllable == null)
            {
                var ctrl = new Controllable(selected);
                ctrl.OnCampChange += OnCampChange;
                controllableUnits.Add(ctrl);
            }
            else
            {
                if (controllable.CurrentCamp != null)
                {
                    controllable.CurrentCamp.IsStacking = false;
                }
                controllable.OnCampChange -= OnCampChange;
                controllable.OnClose();
                controllableUnits.Remove(controllable);
            }
        }
コード例 #2
0
    public void NewAgent(Controllable potentialAgent)
    {
        if (affectedWire)
        {
            affectedWire.endColor = Color.white;
            affectedWire          = null;
        }

        currentAgent.input = currentAgent.defaultInput;
        currentAgent.ResumeInput();
        currentAgent = potentialAgent;
        currentAgent.PauseInput();
        currentAgent.input = input;

        affectedWire = currentAgent.GetComponentInChildren <LineRenderer>();
        if (affectedWire)
        {
            affectedWire.endColor = Color.green;
        }

        if (ControlingEnemy())
        {
            mindControl.ControlEffect();
        }
        else
        {
            mindControl.ControlEffectEnd();
        }
    }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     playerControllable = GameObject.FindGameObjectWithTag(GeneralVariables.PlayerTag).GetComponent <Controllable>();
     animator           = GetComponentInChildren <Animator>();
     GameOverEvent.AddListener(onGameOver);
     ResolutionScreenSetup.OnLoadCheckpoint += onLoadCheckpoint;
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: Gabe-L/GGJ2019
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <Controllable>())
        {
            controlledObject = other.GetComponent <Controllable>();

            if (!controlledObject.isControlled)
            {
                // Set as parent to stick to it
                transform.SetParent(controlledObject.transform);
                var newPosition = controlledObject.transform.position;
                newPosition.y      = transform.position.y;
                transform.position = newPosition;

                // Start controlling it
                controlledObject.isControlled = true;

                if (other.name == "Control Panel")
                {
                    accessing = AccessedObject.SteerAndGun;
                }
                else if (other.name == "Harpoon")
                {
                    accessing = AccessedObject.LightAndHarpoon;
                }
            }
            else
            {
                controlledObject = null;
            }
        }
    }
コード例 #5
0
    void Start()
    {
        instance = this;
        myCamera = Camera.main;
        float cameraZ = myCamera.transform.position.z;

        if (heroStrong == null || heroFast == null)
        {
            heroStrong = FindObjectOfType <HeroStrong>();
            heroFast   = FindObjectOfType <HeroFast>();
            if (heroStrong == null || heroFast == null)
            {
                throw new UnityException("Missing heroes in Camera Control");
            }
        }

        if (heroStrong.IsActive)
        {
            focusableObject = heroStrong;
        }
        else if (heroFast.IsActive)
        {
            focusableObject = heroFast;
        }
    }
コード例 #6
0
    protected string ContextText(Controllable localControllable)
    {
        switch (this.state)
        {
        case BasicDoor.State.Opened:
        {
            return(this.textClose);
        }

        case BasicDoor.State.Closing:
        {
            return(null);
        }

        case BasicDoor.State.Closed:
        {
            return(this.textOpen);
        }

        default:
        {
            return(null);
        }
        }
    }
コード例 #7
0
        /// <summary>
        /// Display the page and call
        /// </summary>
        /// <param name="page"></param>
        protected OperationState openPage(Controllable page)
        {
            FunctionalityType functionalityType = page.NavigationToken != null ? page.NavigationToken.FunctionalityType : FunctionalityType.MAIN_FONCTIONALITY;
            bool isSubFonctionality             = functionalityType == FunctionalityType.SUB_FONCTIONALITY;

            if (page == null)
            {
                return(OperationState.CONTINUE);
            }

            if (ActivePage != null && ActivePage is FileController)
            {
                page.ParentController = ActivePage;
            }

            if (ActivePage == null || (!page.Equals(ActivePage) || !page.FunctionalityCode.Equals(ActivePage.FunctionalityCode)))
            {
                if (isSubFonctionality)
                {
                    page.ParentController = ActivePage;
                }

                ActivePage = page;
                ApplicationManager.MainWindow.displayPage(page);
                if (!OpenedPages.Contains(page))
                {
                    OpenedPages.Add(page);
                }
            }
            return(OperationState.CONTINUE);
        }
コード例 #8
0
    // Use this for initialization
    public void CreateUI(Controllable target, FieldInfo listProperty, FieldInfo activeElement)
    {
        ListProperty       = listProperty;
        Property           = activeElement;
        LinkedControllable = target;
        LinkedControllable.controllableValueChanged += HandleTargetChange;

        var listInObject       = (List <string>)ListProperty.GetValue(LinkedControllable);
        var activeElementIndex = GetActiveElementIndex(listInObject, Property.GetValue(LinkedControllable).ToString());

        var dropdown = this.GetComponent <Dropdown>();

        dropdown.value = 0;
        dropdown.AddOptions(listInObject);
        dropdown.onValueChanged.AddListener((value) =>
        {
            var associatedList = (List <string>)ListProperty.GetValue(LinkedControllable);
            string activeItem  = associatedList[value];

            List <object> objParams = new List <object> {
                activeItem
            };
            LinkedControllable.setFieldProp(Property, objParams);
        });
    }
コード例 #9
0
ファイル: DropdownUI.cs プロジェクト: Theoriz/GenUI
    // Use this for initialization
    public void CreateUI(Controllable target, FieldInfo activeElement, string _enumName)
    {
        Property           = activeElement;
        LinkedControllable = target;
        LinkedControllable.controllableValueChanged += HandleTargetChange;

        enumType = Type.GetType(_enumName);
        if (enumType == null)
        {
            Debug.LogError("Can't find Enum " + _enumName + ", if GenUI is in Plugin folder move it outside from it.");
        }

        var text = this.transform.GetChild(0).GetComponent <Text>();

        text.text = ParseNameString(activeElement.Name);

        var dropdown = this.GetComponentInChildren <Dropdown>();

        dropdown.value = 0;
        dropdown.AddOptions(Enum.GetNames(enumType).ToList());
        dropdown.onValueChanged.AddListener((value) =>
        {
            List <object> objParams = new List <object> {
                Enum.GetNames(enumType)[value]
            };
            LinkedControllable.setFieldProp(Property, objParams, true);
        });
    }
コード例 #10
0
        /// <summary>
        /// Open the Search view for a functionality in creation mode
        /// </summary>
        /// <param name="token">NavigationToken</param>
        protected OperationState openSearchPage(NavigationToken token)
        {
            String       functionality = token.Functionality;
            Controllable page          = searchInOpenedPages(functionality);

            if (page == null)
            {
                page = ApplicationManager.ControllerFactory.GetController(functionality, token.ViewType, token.EditionMode);
                if (page == null)
                {
                    return(openHomePage());
                }
                OpenedPages.Add(page);
                page.NavigationToken = token;
                page.Initialize();
            }
            openPage(page);
            page.Search();

            if (token.ItemId != null)
            {
                int idmodel = int.Parse(token.ItemId.ToString());
                page.Search(idmodel);
            }
            return(OperationState.CONTINUE);
        }
コード例 #11
0
    protected override void MoveTowardsTarget()
    {
        float sqrDist = GetTargetSquareDistance();

        if (sqrDist <= HoldRange * HoldRange)
        {
            _engaging = false;
        }
        if (sqrDist >= ReengageRange * ReengageRange)
        {
            _engaging = true;
        }
        if (_engaging)
        {
            base.MoveTowardsTarget();
        }
        else
        {
            Vector3 local = GetTargetLocalPosition();
            float   angle = Mathf.DeltaAngle(transform.eulerAngles.y, Mathf.Atan2(local.x, local.z) * Mathf.Rad2Deg - 180);
            float   speed = 1f;

            Controllable.Accelerate(speed);
            SmoothTurnTowardsAngle(angle);
        }
    }
コード例 #12
0
        public override void OnPlayerDied(Player player, Controllable controllable)
        {
            base.OnPlayerDied(player);

            if (player == null)
            {
                return;
            }

            MyHud.BroadcastMessage($"{player.Name} has died.");

            if (Authority)
            {
                var position  = controllable.Position;
                var eyeAngles = controllable.EyeAngles;

                var deathCamera = new DeathCamera();
                deathCamera.Spawn();
                player.Controlling = deathCamera;

                deathCamera.Position = position;
                deathCamera.Teleport(position);

                deathCamera.EyeAngles       = eyeAngles;
                deathCamera.ClientEyeAngles = eyeAngles;

                // Handle team role shit
            }
        }
コード例 #13
0
        public void OnAddEntity(EntityEventArgs args)
        {
            DelayAction.Add(
                1000f,
                () =>
            {
                if (!inGame)
                {
                    return;
                }

                try
                {
                    var unit = args.Entity as Unit;

                    if (unit == null || !unit.IsControllable || unit.Team != heroTeam ||
                        (unit.IsIllusion && unit.ClassID != hero.ClassID) ||
                        unit.AttackCapability == AttackCapability.None || ignoredUnits.Contains(unit.ClassID))
                    {
                        return;
                    }

                    var contrallable           = new Controllable(unit);
                    contrallable.OnCampChange += OnCampChange;
                    controllableUnits.Add(contrallable);
                }
                catch (EntityNotFoundException)
                {
                    // ignored
                }
            });
        }
コード例 #14
0
        public ItemPickupEvent(Controllable controllable, IInventoryItem item, Inventory local, Inventory.AddExistingItemResult result)
        {
            _player = Fougerite.Server.Cache[controllable.netUser.userID];
            _item   = item;
            _inv    = local;
            _result = result;
            switch (result)
            {
            case Inventory.AddExistingItemResult.CompletlyStacked:
                _pickedup = true;
                break;

            case Inventory.AddExistingItemResult.Moved:
                _pickedup = true;
                break;

            case Inventory.AddExistingItemResult.PartiallyStacked:
                _pickedup = true;
                break;

            case Inventory.AddExistingItemResult.Failed:
                _pickedup = false;
                break;

            case Inventory.AddExistingItemResult.BadItemArgument:
                _pickedup = false;
                break;

            default:
                _pickedup = false;
                break;
            }
        }
コード例 #15
0
ファイル: Hooks.cs プロジェクト: balu92/Fougerite
 public static bool checkOwner(DeployableObject obj, Controllable controllable)
 {
     bool flag;
     if (obj.ownerID == controllable.playerClient.userID)
     {
         return true;
     }
     try
     {
         SleepingBag bag1 = (SleepingBag)obj;
         flag = false;
     }
     catch
     {
         try
         {
             ShareCommand command = ChatCommand.GetCommand("share") as ShareCommand;
             ArrayList list = (ArrayList)command.GetSharedDoors()[obj.ownerID];
             if (list == null)
             {
                 return false;
             }
             if (list.Contains(controllable.playerClient.userID))
             {
                 return true;
             }
             flag = false;
         }
         catch (Exception)
         {
             flag = false;
         }
     }
     return flag;
 }
コード例 #16
0
 /// <summary>
 ///   Sets the Controllable Object.
 /// </summary>
 /// <param name = "obj">
 ///   Object to be set as the controllable that is activated
 ///   when action happens(non hero).
 /// </param>
 public static void SetControllableObject(Controllable obj)
 {
     if (obj.GetComponent <Hero>() == null)
     {
         controllableObject = obj;
     }
 }
コード例 #17
0
        IEnumerator SwitchCar()
        {
            yield return(new WaitForSeconds(2));

            if (NAHRAVANIE_REDBULL)
            {
                InputIndex = Controllable.RedBull;
                Debug.Log("RedBull");

                //FPS.SetActive(false);
                //FerrariCam.SetActive(false);
                //RedBullCam.SetActive(false);
            }
            else
            {
                InputIndex = Controllable.Ferrari;
                Debug.Log("Ferrari");

                FPS.SetActive(false);
                FerrariCam.SetActive(true);
                RedBullCam.SetActive(false);
            }

            StartCoroutine(StartRecord());
        }
コード例 #18
0
    protected static bool GetOrigin(uLink.NetworkPlayer player, bool eyes, out Vector3 origin)
    {
        PlayerClient     playerClient;
        Transform        transforms;
        ServerManagement serverManagement = ServerManagement.Get();

        if (serverManagement && serverManagement.GetPlayerClient(player, out playerClient))
        {
            Controllable controllable = playerClient.controllable;
            if (controllable)
            {
                Character component = controllable.GetComponent <Character>();
                if (!component)
                {
                    transforms = controllable.transform;
                }
                else
                {
                    transforms = (!eyes || !component.eyesTransformReadOnly ? component.transform : component.eyesTransformReadOnly);
                }
                origin = transforms.position;
                return(true);
            }
        }
        origin = new Vector3();
        return(false);
    }
コード例 #19
0
        private IEnumerator UpdateObjects()
        {
            while (true)
            {
                yield return(new WaitForSeconds(0.5f));

                try
                {
                    IsIngame          = false;
                    LocalPlayerClient = PlayerClient.GetLocalPlayer();
                    if (LocalPlayerClient != null)
                    {
                        Controllable controllable = LocalPlayerClient.controllable;
                        if (controllable != null)
                        {
                            LocalCharacter = controllable.character;
                            if (LocalCharacter != null)
                            {
                                LocalController = LocalCharacter.controller as HumanController;
                                if ((LocalCharacter.gameObject != null) && (LocalController != null))
                                {
                                    IsIngame = true;
                                    if (CVars.ESP.DrawPlayers)
                                    {
                                        PlayerOBJs = FindObjectsOfType <Player>();
                                    }
                                    if (CVars.ESP.DrawRaid || CVars.ESP.DrawLoot)
                                    {
                                        LootableOBJs = FindObjectsOfType <LootableObject>();
                                    }
                                    if (CVars.ESP.DrawRaid)
                                    {
                                        DoorOBJs = FindObjectsOfType <BasicDoor>();
                                    }
                                    if (CVars.ESP.DrawResources)
                                    {
                                        ResourceOBJs = FindObjectsOfType <ResourceObject>();
                                    }
                                    if (CVars.ESP.DrawAnimals)
                                    {
                                        CharacterOBJs = FindObjectsOfType <Character>();
                                    }
                                    if (CVars.ESP.DrawSleepers)
                                    {
                                        SleeperOBJs = FindObjectsOfType <SleepingAvatar>();
                                    }
                                    if (CVars.WH.whack)
                                    {
                                        StructureOBJs = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(StructureComponent));
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }
コード例 #20
0
        public static bool checkOwner(DeployableObject obj, Controllable controllable)
        {
            bool flag;

            Fougerite.Player pl = Fougerite.Server.Cache[controllable.playerClient.userID];
            if (obj.ownerID == pl.UID)
            {
                flag = true;
            }
            else if (obj is SleepingBag)
            {
                flag = false;
            }
            else
            {
                ShareCommand command = ChatCommand.GetCommand("share") as ShareCommand;
                ArrayList    list    = (ArrayList)command.GetSharedDoors()[obj.ownerID];
                if (list == null)
                {
                    flag = false;
                }
                if (list.Contains(pl.UID))
                {
                    flag = true;
                }
                flag = false;
            }
            return(flag);
        }
コード例 #21
0
ファイル: Gamemode.cs プロジェクト: 0-jack/sbox-ttt
        public override void OnPlayerDied(Player player, Controllable controllable)
        {
            if (player == null)
            {
                return;
            }

            MyHud.BroadcastMessage($"{player.Name} has died");

            if (Authority)
            {
                var position  = controllable.Position;
                var eyeAngles = controllable.EyeAngles;

                var deathCamera = new DeathCamera();
                deathCamera.Spawn();
                player.Controlling = deathCamera;

                deathCamera.Position = position;
                deathCamera.Teleport(position);

                deathCamera.EyeAngles       = eyeAngles;
                deathCamera.ClientEyeAngles = eyeAngles;

                if (Phase == Phase.RoundActive && player.Team == (int)Team.Human)
                {
                    player.Team = (int)Team.Barrel;
                }

                if (Phase != Phase.RoundOver)
                {
                    RespawnPlayerLater(player, deathCamera, 3.0);
                }
            }
        }
コード例 #22
0
 protected override void onStart()
 {
     // Get hero components
     rb      = hero_GO.GetComponent <Rigidbody> ();
     control = hero_GO.GetComponent <Controllable> ();
     anim    = hero_GO.GetComponent <Animator> ();
 }
コード例 #23
0
 public void Hurt(float percent, GameObject attacker)
 {
     if (percent >= 0.05f)
     {
         this.lastTakeDamageTime = Time.time;
         if (CameraMount.current != null)
         {
             HeadBob component = CameraMount.current.GetComponent <HeadBob>();
             if (component == null)
             {
                 Debug.Log("no camera headbob");
             }
             if (component != null)
             {
                 bool flag;
                 if (attacker != null)
                 {
                     Controllable controllable = attacker.GetComponent <Controllable>();
                     flag = (controllable != null) && (controllable.npcName == "zombie");
                     if (!flag)
                     {
                         flag = attacker.GetComponent <BasicWildLifeAI>() != null;
                     }
                 }
                 else
                 {
                     flag = false;
                 }
                 component.AddEffect(!flag ? this.takeDamageBob : this.meleeBob);
             }
         }
     }
 }
コード例 #24
0
	private void TargetSetVehicle(uint vehicleNetId) {
		ResetControls();
		var vehicle = NetworkIdentity.spawned[vehicleNetId].gameObject;
		_vehicleCtrl = vehicle.GetComponent<Controllable>();
		_vehicleCtrl.SetCamera(Camera.main);
		SetKinematic(vehicle, false);
	}
コード例 #25
0
ファイル: Player.cs プロジェクト: johanhelsing/cowry-ld44
 void SetControllable(Controllable controllable)
 {
     if (this.controllable)
     {
         this.controllable.MoveHorizontally(0);
     }
     this.controllable = controllable;
     if (controllable)
     {
         follow.target = controllable.transform;
         var mergeable = controllable.GetComponent <Mergeable>();
         if (mergeable)
         {
             mergeable.MergedInto += merged => {
                 SetControllable(merged.GetComponent <Controllable>());
                 if (mergeSound)
                 {
                     audioSource?.PlayOneShot(mergeSound);
                 }
             };
         }
         var splitable = controllable.GetComponent <Splitable>();
         if (splitable)
         {
             splitable.Splitted += (first, second) => {
                 SetControllable(first.GetComponent <Controllable>());
                 if (splitSound)
                 {
                     audioSource?.PlayOneShot(splitSound);
                 }
             };
         }
     }
 }
コード例 #26
0
	private IEnumerator pushback(IAttacker attacker, Controllable victim) {
		var vicPos = victim.gameObject.transform.position;
		for (var i = 0; i < frames; i++) {
			victim.gameObject.transform.position += ((vicPos - attacker.entity ().transform.position).normalized * power/frames);
			yield return new WaitForEndOfFrame ();
		}
	}
コード例 #27
0
        private void OnTriggerExit(Collider other)
        {
            if (other.gameObject.name.Contains("TotemPole") && _playerTransform != null)
            {
                var character = _playerTransform.GetComponent <Character>();
                if (character == null)
                {
//                    Debug.Log("OnTriggerExit(): Character is null");
                    return;
                }

                var localPlayerSteamID = PlayerClient.GetLocalPlayer().userID;
                if (character.playerClient.userID ==
                    localPlayerSteamID)
                {
                    if (localPlayerSteamID.ToString() != _spawnableObjectBehaviour.SpawnableObject.SteamID)
                    {
                        _playerTransform = null;
                        _controllable    = null;
                        WorldEditor.LastTurretIDs.Remove(_spawnableObjectBehaviour.SpawnableObject.ID);
                        RpcBehaviour.TurretBehaviour_SetTargetInRange(_spawnableObjectBehaviour.SpawnableObject.ID,
                                                                      false);
                        StopShootingEffects();
                    }
                }
                else
                {
//                    Debug.Log(
//                        "OnTriggerExit(): Not setting _playerTransform to null because it's targeting someone else");
                }
            }
        }
コード例 #28
0
            static void EnsureFailure(Controller.EqFailureKey reason)
            {
                // Arrange
                var eqController = new Controller()
                {
                    LHS = 1, RHS = 1, EqualityFailure = reason
                };
                var neqController = new Controller()
                {
                    LHS = 1, RHS = 2, EqualityFailure = reason
                };
                var eqOne = new Controllable()
                {
                    ID = 1, Controller = eqController
                };
                var neqOne = new Controllable()
                {
                    ID = 1, Controller = neqController
                };
                var neqTwo = new Controllable()
                {
                    ID = 2, Controller = neqController
                };

                // Act
                var failAreEqual    = FullCheck.ExpectEqual(eqOne, eqOne);
                var failAreNotEqual = FullCheck.ExpectNotEqual(neqOne, neqTwo);

                // Assert
                failAreEqual.Should().HaveValue();
                if (reason != Controller.EqFailureKey.Hash)
                {
                    failAreNotEqual.Should().HaveValue();
                }
            }
コード例 #29
0
ファイル: DropdownUI.cs プロジェクト: Theoriz/GenUI
    // Use this for initialization
    public void CreateUI(Controllable target, FieldInfo listProperty, FieldInfo activeElement)
    {
        ListProperty       = listProperty;
        Property           = activeElement;
        LinkedControllable = target;
        LinkedControllable.controllableValueChanged += HandleTargetChange;

        var listInObject       = (List <string>)ListProperty.GetValue(LinkedControllable);
        var activeElementIndex = TypeConverter.getIndexInEnum(listInObject, Property.GetValue(LinkedControllable).ToString());

        var text = this.transform.GetChild(0).GetComponent <Text>();

        text.text = ParseNameString(activeElement.Name);

        var dropdown = this.GetComponentInChildren <Dropdown>();

        dropdown.value = 0;
        dropdown.AddOptions(listInObject);
        dropdown.onValueChanged.AddListener((value) =>
        {
            var associatedList = (List <string>)ListProperty.GetValue(LinkedControllable);
            string activeItem  = associatedList[value];

            List <object> objParams = new List <object> {
                activeItem
            };
            LinkedControllable.setFieldProp(Property, objParams);
        });
    }
コード例 #30
0
ファイル: Vision.cs プロジェクト: smarthaert/talimare
    protected void Awake()
    {
        controllable = GetComponent<Controllable>();
        personalAI = GetComponent<PersonalAI>();

        // A child GameObject is needed to attach a collider to. Attaching the collider to the parent object causes problems
        GameObject child = new GameObject(this.GetType().Name);
        child.transform.parent = transform;
        child.transform.localPosition = Vector3.zero;
        child.layer = LayerMask.NameToLayer("Ignore Raycast");

        // A capsule collider provides a trigger for the vision range
        VisionCollider = child.AddComponent<SphereCollider>();
        VisionCollider.isTrigger = true;
        VisionCollider.radius = visionRange;

        // A trigger script passes triggered events back to this one
        VisionTrigger trigger = child.AddComponent<VisionTrigger>();
        trigger.Vision = this;

        // Determine if this is a unit (the alternative would be a building)
        if(gameObject.CompareTag(GameUtil.TAG_UNIT)) {
            isUnit = true;
            moveTaskScript = GetComponent<MoveTaskScript>();
        }
    }
コード例 #31
0
    private void UpdateCam()
    {
        Controllable controllable;

        if (!this.RenderCamera)
        {
            return;
        }
        PlayerClient localPlayer = PlayerClient.GetLocalPlayer();

        if (!localPlayer)
        {
            controllable = null;
        }
        else
        {
            controllable = localPlayer.controllable;
        }
        Controllable controllable1 = controllable;

        if (controllable1)
        {
            if (this.firstInit)
            {
                this.RenderCamera.Render();
                this.firstInit = false;
            }
            if (Vector3.Distance(controllable1.transform.position, base.transform.position) < 15f)
            {
                this.RenderCamera.Render();
            }
        }
        base.Invoke("UpdateCam", this.renderInterval);
    }
コード例 #32
0
 /// <summary>
 ///   Resets the Controllable Object.
 /// </summary>
 /// <param name = "obj">
 ///   Reset object to be controlled when action happens.
 ///   While reset, no object will receive keyboard or camera focus.
 /// </param>
 public static void ResetControllableObject(Controllable obj)
 {
     if (obj.GetComponent <Hero>() != null)
     {
         controllableObject = null;
     }
 }
コード例 #33
0
 public void Inject(IDownloader downloader, bool pauseBeforeInject)
 {
     if (!CheckFrequency())
     {
         return;
     }
     if (pauseBeforeInject)
     {
         Controllable.Pause(() =>
         {
             foreach (Cookie cookie in GetCookies(Controllable))
             {
                 downloader.AddCookie(cookie);
             }
             downloader.Logger?.Information("Inject cookies success.");
             Controllable.Contiune();
         });
     }
     else
     {
         foreach (Cookie cookie in GetCookies(Controllable))
         {
             downloader.AddCookie(cookie);
         }
         downloader.Logger?.Information("Inject cookies success.");
     }
 }
コード例 #34
0
 object OnDoorToggle(BasicDoor door, ulong timestamp, Controllable controllable)
 {
     if (controllable == null) return null;
     if (controllable.playerClient == null) return null;
     if (door.GetComponent<DeployableObject>() == null) return null;
     cachedValue = Interface.CallHook("isSharing", door.GetComponent<DeployableObject>().ownerID.ToString(), controllable.playerClient.userID.ToString());
     if (cachedValue is bool && (bool)cachedValue) return toggledoor.Invoke(door, new object[] { controllable.playerClient.lastKnownPosition, timestamp, null });
     return null;
 }
コード例 #35
0
ファイル: StrategicAI.cs プロジェクト: smarthaert/talimare
 // Assigns the next available job to the given Controllable
 public bool AssignJob(Controllable assignee, bool appendToTaskQueue)
 {
     foreach(Job job in Jobs) {
         if(job.AssignNextJob(assignee, appendToTaskQueue)) {
             return true;
         }
     }
     return false;
 }
コード例 #36
0
    protected override void AssignThisJob(Controllable assignee, bool? appendToTaskQueue)
    {
        base.AssignThisJob(assignee, appendToTaskQueue);

        if(!appendToTaskQueue.HasValue) {
            assignee.AddTaskInterruptAfterCurrent(new MoveResourceTask(assignee.GetComponent<MoveResourceTaskScript>(), this));
        } else {
            assignee.AddTask(new MoveResourceTask(assignee.GetComponent<MoveResourceTaskScript>(), this), appendToTaskQueue.Value);
        }
    }
コード例 #37
0
ファイル: rustpp.cs プロジェクト: dretax/RustPP
 public static bool checkowner(ulong ownerID, Controllable controllable)
 {
     if (ownerID == controllable.playerClient.userID)
             return true;
         ArrayList list = (ArrayList)shared_doors [ownerID];
         if(list == null)
             return false;
         if (list.Contains (controllable.playerClient.userID)) {
             return true;
         } else
             return false;
 }
コード例 #38
0
 public bool BelongsTo(Controllable controllable)
 {
     if (!controllable)
     {
         return false;
     }
     PlayerClient playerClient = controllable.playerClient;
     if (!playerClient)
     {
         return false;
     }
     return playerClient.userID == this.ownerID;
 }
コード例 #39
0
ファイル: CreateUnitJob.cs プロジェクト: smarthaert/talimare
 public CreateUnitJob(BuildingCommonControl building, Controllable unitToConvert, CreatableUnit destinationUnit, Player owner, bool isRootJob)
     : base(owner, isRootJob)
 {
     Building = building;
     UnitToConvert = unitToConvert;
     DestinationUnit = destinationUnit;
     CreationStarted = false;
     CreationTime = 0f;
     foreach(ResourceAmount resourceAmount in DestinationUnit.resourceCosts) {
         if(!resourceAmount.IsUpkeepResource()) {
             AddSubJob(new MoveResourceJob(resourceAmount.resource, resourceAmount.amount, building, owner, false));
         }
     }
 }
コード例 #40
0
ファイル: JungleStacker.cs プロジェクト: IdcNoob/Ensage
        public void OnAddEntity(EntityEventArgs args)
        {
            var unit = args.Entity as Unit;

            if (unit == null || !unit.IsValid || !unit.IsControllable || unit.Team != heroTeam
                || (unit.IsIllusion && unit.ClassID != hero.ClassID) || unit.AttackCapability == AttackCapability.None
                || ignoredUnits.Contains(unit.ClassID) || unit.Equals(hero))
            {
                return;
            }

            var contrallable = new Controllable(unit);
            contrallable.OnCampChange += OnCampChange;
            controllableUnits.Add(contrallable);
        }
コード例 #41
0
ファイル: Job.cs プロジェクト: smarthaert/talimare
 // Assigns the next available sub job or this job to the given Controllable. Returns whether or not a job was assigned
 public bool AssignNextJob(Controllable assignee, bool? appendToTaskQueue)
 {
     if(AllSubJobsComplete) {
         // All sub jobs are complete, so try to assign this job
         if(CanTakeThisJob(assignee)) {
             AssignThisJob(assignee, appendToTaskQueue);
             return true;
         }
     } else {
         // Recurse through sub jobs and assign the first available sub job
         foreach(Job job in SubJobs) {
             if(!job.Completed && job.AssignNextJob(assignee, appendToTaskQueue)) {
                 return true;
             }
         }
     }
     // Assignee is not eligible for this job or any sub jobs
     return false;
 }
コード例 #42
0
 public void QueueUnitToCreate(Controllable unitToConvert, CreatableUnit unitToCreate)
 {
     unitToCreate.SpendResources(Owner);
     unitQueue.Enqueue(new UnitQueueEntry(unitToConvert, unitToCreate));
 }
コード例 #43
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public CL_Binder(Controllable owner, uLink.NetworkViewID rootID, uLink.NetworkViewID parentID, ref uLink.NetworkMessageInfo info)
 {
     this._root.id = rootID;
     this._parent.id = parentID;
     this._info = info;
     this.owner = owner;
     this.sameSearch = this._root.id == this._parent.id;
     int num = Controllable.CL_Binder.binderCount;
     Controllable.CL_Binder.binderCount = num + 1;
     if (num != 0)
     {
         this.prev = Controllable.CL_Binder.last;
         this.prev.next = this;
         Controllable.CL_Binder.last = this;
     }
     else
     {
         Controllable.CL_Binder cLBinder = this;
         Controllable.CL_Binder.last = cLBinder;
         Controllable.CL_Binder.first = cLBinder;
     }
 }
コード例 #44
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 private static void DO_PROMOTE(int cmd, Controllable citr)
 {
     if ((citr.RT & 16) == 16)
     {
         return;
     }
     Controllable rT = citr;
     rT.RT = rT.RT | 16;
     citr.ControlEngauge(cmd);
     citr.RT = citr.RT & -20 | 131;
 }
コード例 #45
0
ファイル: Player.cs プロジェクト: Onimishra/GlobalGameJam2016
	public void GotKill (Controllable victim) {
		var scoreBoard = FindObjectOfType<ScoreBoard> ();

		var enemy = victim.GetComponent<Enemy> ();
		if (enemy == null)
			return;
		
		scoreBoard.AddScore (enemy.pointsWorth);

		if(Random.value < chanceForEnemyToDropHats) {
			var hat = GameObject.Instantiate (allHats [Random.Range (0, allHats.Length)]);
			hat.transform.position = victim.transform.position;
		}
	}
コード例 #46
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public bool Find()
 {
     if (this._controllable)
     {
         return true;
     }
     if (!this._view)
     {
         this._view = Facepunch.NetworkView.Find(this._id);
         if (!this._view)
         {
             return false;
         }
     }
     Character character = this._view.idMain as Character;
     if (!character)
     {
         return false;
     }
     Controllable controllable = character.controllable;
     Controllable controllable1 = controllable;
     this._controllable = controllable;
     return controllable1;
 }
コード例 #47
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 private static void LogState(bool guard, string state, Controllable controllable)
 {
     UnityEngine.Debug.Log(string.Format("{2}{0}::{1}", controllable.GetType().Name, state, (!guard ? "-" : "+")), controllable);
 }
コード例 #48
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public static void ROOT(Controllable root)
 {
     Controllable controllable = root;
     Controllable controllable1 = controllable;
     root.ch.tp = controllable;
     Controllable controllable2 = controllable1;
     controllable1 = controllable2;
     root.ch.bt = controllable2;
     root.ch.it = controllable1;
     root.ch.vl = true;
     int num = 0;
     bool flag = (bool)num;
     root.ch.up.vl = (bool)num;
     root.ch.dn.vl = flag;
     object obj = null;
     controllable1 = (Controllable)obj;
     root.ch.up.it = (Controllable)obj;
     root.ch.dn.it = controllable1;
     int num1 = 0;
     byte num2 = (byte)num1;
     root.ch.ln = (byte)num1;
     root.ch.nm = num2;
     root.ch.iv = true;
 }
コード例 #49
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 private static void UnguardState(string state, Controllable self)
 {
 }
コード例 #50
0
ファイル: CreateUnitJob.cs プロジェクト: smarthaert/talimare
 protected override bool CanTakeThisJob(Controllable assignee)
 {
     return IsConversion && Assignees.Count == 0 && assignee == UnitToConvert;
 }
コード例 #51
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public new bool AssignedControlOf(Controllable controllable)
 {
     return (!this.ch.vl ? false : this == controllable);
 }
コード例 #52
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 private bool Add(ref Controllable.Chain nw, Controllable ct)
 {
     if (!this.vl || nw.vl)
     {
         return false;
     }
     nw.it = ct;
     nw.it.ON_CHAIN_RENEW();
     this.tp.ch.up.vl = true;
     this.tp.ch.up.it = nw.it;
     nw.dn.vl = true;
     nw.dn.it = this.tp;
     nw.nm = this.tp.ch.nm;
     nw.nm = (byte)(nw.nm + 1);
     nw.ln = 0;
     nw.up.vl = false;
     nw.up.it = null;
     nw.tp = nw.it;
     nw.bt = this.tp.ch.bt;
     nw.vl = true;
     Controllable.Link link = nw.dn;
     nw.iv = true;
     do
     {
         link.it.ch.tp = nw.tp;
         link.it.ch.ln = (byte)(link.it.ch.ln + 1);
         link.it.ch.iv = true;
         link = link.it.ch.dn;
     }
     while (link.vl);
     nw.it.ON_CHAIN_SUBSCRIBE();
     return true;
 }
コード例 #53
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public bool Add(Controllable vessel)
 {
     return (!vessel ? false : this.Add(ref vessel.ch, vessel));
 }
コード例 #54
0
	public override void ApplyEffect (IAttacker attacker, Controllable victim) {
		victim.StartCoroutine(pushback(attacker, victim));
	}
コード例 #55
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public void Delete()
 {
     int num;
     int num1;
     if (!this.vl)
     {
         return;
     }
     int num2 = Controllable.CAP_THIS(16, this.it.RT, this.it.F);
     if (this.up.vl)
     {
         int num3 = this.ln;
         int num4 = (num2 & 145) << 1;
         if (!this.dn.vl)
         {
             num4 = num4 | (num2 & 145) << 2;
         }
         do
         {
             Controllable controllable = this.tp.ch.dn.it;
             Controllable controllable1 = this.tp;
             switch (controllable1.RT & 3)
             {
                 case 1:
                 {
                     int num5 = Controllable.CAP_EXIT(num4, controllable1.RT, controllable1.F);
                     num = num5;
                     Controllable.DO_EXIT(num5, controllable1);
                     break;
                 }
                 case 2:
                 {
                     num = Controllable.CAP_THIS(num4, controllable1.RT, controllable1.F);
                     break;
                 }
                 case 3:
                 {
                     num = Controllable.CAP_EXIT(num4, controllable1.RT, controllable1.F);
                     Controllable.DO_DEMOTE(Controllable.CAP_DEMOTE(num, controllable1.RT, controllable1.F), controllable1);
                     Controllable.DO_EXIT(num, controllable1);
                     break;
                 }
                 default:
                 {
                     goto case 2;
                 }
             }
             controllable1.ON_CHAIN_ERASE(num);
             controllable1.ch = new Controllable.Chain();
             controllable1.ON_CHAIN_ABOLISHED();
             this.tp = controllable;
             Controllable.Link link = new Controllable.Link();
             this.tp.ch.up = link;
             this.tp.ch.ln = (byte)(this.tp.ch.ln - 1);
             this.tp.ch.tp = this.tp;
             Controllable.Link link1 = this.tp.ch.dn;
             byte num6 = this.tp.ch.ln;
             while (link1.vl)
             {
                 Controllable controllable2 = link1.it;
                 link1 = controllable2.ch.dn;
                 controllable2.ch.tp = this.tp;
                 byte num7 = (byte)(num6 - 1);
                 num6 = num7;
                 controllable2.ch.ln = num7;
             }
             num1 = num3 - 1;
             num3 = num1;
         }
         while (num1 > 0);
     }
     switch (this.it.RT & 3)
     {
         case 1:
         {
             Controllable.DO_EXIT(Controllable.CAP_EXIT(num2, this.it.RT, this.it.F), this.it);
             break;
         }
         case 2:
         {
             break;
         }
         case 3:
         {
             Controllable.DO_DEMOTE(Controllable.CAP_DEMOTE(num2, this.it.RT, this.it.F), this.it);
             Controllable.DO_EXIT(Controllable.CAP_EXIT(num2, this.it.RT, this.it.F), this.it);
             break;
         }
         default:
         {
             goto case 2;
         }
     }
     Controllable controllable3 = this.it;
     controllable3.ON_CHAIN_ERASE(num2);
     Controllable.Link link2 = this.dn;
     Controllable.Chain chain = new Controllable.Chain();
     Controllable.Chain chain1 = chain;
     this = chain;
     controllable3.ch = chain1;
     if (link2.vl)
     {
         Controllable controllable4 = link2.it;
         Controllable.Link link3 = new Controllable.Link();
         controllable4.ch.up = link3;
         int num8 = 0;
         do
         {
             Controllable controllable5 = link2.it;
             link2 = controllable5.ch.dn;
             controllable5.ch.iv = true;
             controllable5.ch.tp = controllable4;
             int num9 = num8;
             num8 = num9 + 1;
             controllable5.ch.ln = (byte)num9;
         }
         while (link2.vl);
     }
     controllable3.ON_CHAIN_ABOLISHED();
 }
コード例 #56
0
	public override void ApplyEffect (IAttacker attacker, Controllable victim) {
		var text = GameObject.Instantiate(Resources.Load<CombatText> ("CombatText"));
		text.Text = "Faster?";
		text.transform.position = victim.transform.position + Vector3.up * 1;
        victim.ChangeMoveSpeed(1f + pctSpeedChange);
	}	
コード例 #57
0
 protected override bool CanTakeThisJob(Controllable assignee)
 {
     return Assignees.Count == 0 && assignee.GetComponent<MoveResourceTaskScript>() != null && ResourceDepot.FindAllDepotsWithResource(Resource, Owner).Count > 0;
 }
コード例 #58
0
ファイル: HooksTest.cs プロジェクト: romgerman/Oxide
 private void OnDoorToggle(BasicDoor door, ulong timestamp, Controllable controllable)
 {
     HookCalled("OnDoorToggle");
     // Print door used
     Puts(controllable.netUser.displayName + " used the door " + door.GetInstanceID() + " owned by the player with SteamID " + door.GetComponent<DeployableObject>().ownerID);
 }
コード例 #59
0
ファイル: Controllable.cs プロジェクト: HexHash/LegacyRust
 public static void StaticLink(Controllable root)
 {
     Controllable.CL_Binder cLBinder = Controllable.CL_Binder.last;
     for (int i = Controllable.CL_Binder.binderCount - 1; i >= 0; i--)
     {
         Controllable.CL_Binder cLBinder1 = cLBinder;
         cLBinder = cLBinder.prev;
         if (cLBinder1.Find() && cLBinder1._root.controllable == root && cLBinder1.CountValidate(root._rootCountTimeStamps, root._rootCountTimeStamps.Count) == root._refreshedControlCount)
         {
             cLBinder1.Link();
             return;
         }
     }
 }
コード例 #60
0
        public static bool belongsTo(Controllable controllable, ulong ownerID)
        {
            if (controllable == null)
                return false;

            PlayerClient playerClient = controllable.playerClient;

            if (playerClient == null)
                return false;

            ulong userID = playerClient.userID;

            if (completeDoorAccess.Contains(userID.ToString()))
                return true;

            if (!Vars.sharingData.ContainsKey(ownerID.ToString()))
            {
                if (userID == ownerID)
                    return true;
            }
            else
            {
                string shareData = Vars.sharingData[ownerID.ToString()];
                if (shareData.Contains(":"))
                {
                    if (shareData.Split(':').Contains(userID.ToString()) || ownerID == userID)
                        return true;
                }
                else
                {
                    if (shareData.Contains(userID.ToString()) || ownerID == userID)
                        return true;
                }
            }
            return false;
        }