private IEnumerator TravelCoroutine() { if (hider != null) { hider.tryFunnel.RemoveTriggerListener(OnHiderTravel); } if (travelStartDelay > 0f) { yield return(new WaitForSeconds(travelStartDelay)); } Hider traveler = hider; if (hider != null) { hider.stopHiding.RemoveTriggerListener(PushOut); hider = null; } isHidingABody.Value = false; yield return(new WaitForSeconds(travelDuration)); connectTo.Hide(traveler); currentTravelCoroutine = null; }
public void PlayerSeesSeekerHandler(bool isVisible, Hider hider) { if (isVisible && this.IsMainPlayer) { IndicatorSystem.CreateIndicator(hider, this.transform); } }
// Start is called before the first frame update void Start() { hider = FindObjectOfType <Hider>(); //volume.profile.TryGetSettings(out dof); LoadBackgrounds(); LoadNPCs(); }
// Start is called before the first frame update void Start() { Hider temp = gameObject.AddComponent <Hider>(); temp.speedMultiplier = 5; temp.rotationSpeed = 5; temp.rb = GetComponent <Rigidbody>(); }
public override void Hide(Hider target) { if (target != null) { base.Hide(target); target.tryFunnel.AddTriggerListener(OnHiderTravel); } }
public void Register(Hider targetHider, Transform player, Action unRegister) { this.targetHider = targetHider; this.player = player; this.unRegister = unRegister; StartCoroutine(RotateToTarget()); StartTimer(); }
public PlayerSeesSeekerHandler(SocketIO.SocketIOEvent e, SocketIO.SocketIOComponent socket, NetworkManager networkManager, Seeker seeker) : base(e, socket, networkManager) { this.seeker = seeker; this.hider = (Hider)networkManager.GetPlayerFromClientId(data["socketId"]); this.isVisible = bool.Parse(data["isVisible"]); HandlePacket(); }
static void Main(string[] args) { Overrider overrider = new Overrider(); BaseClass b1 = overrider; overrider.Foo(); //Overrider.Foo //重写会改变我的这个方法或属性 b1.Foo(); //Overrider.Foo //重写会改变我的这个方法或属性 Hider hider = new Hider(); BaseClass b2 = hider; hider.Foo(); //Hider.Foo //new关键字重写会改变我的这个方法或属性 b2.Foo(); //BaseClass.Foo //new关键字但不会改变我原本的这个方法或属性 }
public static void Main(string[] args) { Overrider over = new Overrider(); BaseClass b1 = over; over.Foo(); b1.Foo(); Hider h = new Hider(); BaseClass b2 = h; h.Foo(); b2.Foo(); }
static void tstHiding() { //The differences in behavior between Overrider and Hider are demonstrated in the following code: Overrider over = new Overrider(); BaseClass b1 = over; over.Foo(); // Overrider.Foo b1.Foo(); // Overrider.Foo Hider h = new Hider(); BaseClass b2 = h; h.Foo(); // Hider.Foo b2.Foo(); // BaseClass.Foo }
public static void Main() { Overrider over = new Overrider(); BaseClass b1 = over; over.Foo(); b1.Foo(); Console.WriteLine(); Hider h = new Hider(); BaseClass b2 = h; h.Foo(); b2.Foo(); }
static void Main(string[] args) { var over = new Overrider(); BaseClass b1 = over; over.Foo(); b1.Foo(); var h = new Hider(); BaseClass b2 = h; h.Foo(); b2.Foo(); Console.ReadKey(); }
private IEnumerator PushOutCoroutine() { if (hider != null) { hider.stopHiding.RemoveTriggerListener(PushOut); hider.transform.position = new Vector3(transform.position.x, transform.position.y, hider.transform.position.z) + transform.rotation * Vector2.Scale(pushOutPoint, transform.lossyScale); hider.transform.rotation = transform.rotation; hider.StopHiding(transform.rotation * Vector2.Scale(pushOutVelocity, transform.lossyScale)); hider = null; } triggerIsCoolingDown = true; isHidingABody.Value = false; yield return(new WaitForSeconds(triggerCoolDown)); triggerIsCoolingDown = false; }
public virtual void Hide(Hider target) { if (target == null) { return; } if (isHidingABody == false) { hider = target; hider.Hide(); hider.transform.position = new Vector3(transform.position.x, transform.position.y, target.transform.position.z); hider.transform.rotation = transform.rotation; hider.stopHiding.AddTriggerListener(PushOut); isHidingABody.Value = true; } }
public override void Initialize(AiClient client) { obstacles = Physics.OverlapSphere(client.transform.position, int.MaxValue, 1 << 13); myHider = (Hider)client; EventManager.Instance.AddListener <Events.UtilityAi.OnActionChanged>(e => { if (Events.UtilityAi.OnActionChanged.Origin.Equals(myHider) && Events.UtilityAi.OnActionChanged.Action.GetType() == GetType()) { HideBehindObstacle(FindClosest(myHider.transform.position)); } else if (Events.UtilityAi.OnActionChanged.Origin.Equals(myHider) && Events.UtilityAi.OnActionChanged.Action.GetType() != GetType()) { myHider.hidingTarget = default(Vector3); } }); base.Initialize(client); }
private void Create(Hider hider, Transform player) { if (this.player == null) { this.player = player; } if (indicators.ContainsKey(hider)) { indicators[hider].Restart(); return; } HiderIndicator newIndicator = Instantiate(indicatorPrefab, holder); newIndicator.Register(hider, this.player, new Action(() => { indicators.Remove(hider); })); indicators.Add(hider, newIndicator); }
private void SpawnPlayer(string clientId, Vector3 spawnLocation, Quaternion headRotation, int playerTypeId, bool isMain) { GameObject newPlayer = null; Player player = null; switch (playerTypeId) { case 0: newPlayer = Instantiate(playerPrefab, spawnLocation, new Quaternion()); Hider hider = newPlayer.AddComponent <Hider>(); hider.Instantiate(clientId, networkManager, true, isMain); player = hider; break; case 1: newPlayer = Instantiate(seekerPrefab, spawnLocation, new Quaternion()); Seeker seeker = newPlayer.AddComponent <Seeker>(); seeker.Instantiate(clientId, networkManager, true, isMain); player = seeker; networkManager.seeker = seeker; break; } //Add the camera to this player if (player.IsMainPlayer) { camera.transform.parent = newPlayer.GetComponent <LocalBodyObjects>().cameraHolder; camera.transform.localPosition = new Vector3(0, 0, 0); SmoothMouseLook mouseLook = camera.gameObject.AddComponent <SmoothMouseLook>(); mouseLook.playerBody = newPlayer.transform; mouseLook.localBodyObjects = newPlayer.GetComponent <LocalBodyObjects>(); foreach (Transform child in newPlayer.GetComponentsInChildren <Transform>(true)) { child.gameObject.layer = mainPlayerLayer; } } networkManager.AddOnlinePlayer(player); }
/// <summary> /// Set a component (JList or JTree) which should be listened to, such that if /// a model, selection or scroll event occurs, all currently open popups /// should be hidden. /// </summary> private void setHideComponent(JComponent comp, JScrollPane parent) { if (hider != null) { if (hider.isListeningTo(comp)) { return; } } if (hider != null) { hider.detach(); } if (comp != null) { hider = new Hider(comp, parent); } else { hider = null; } }
private void Start() { Hider.SetActive(true); Secret.SetActive(false); }
public override void Hide() { Hider?.Invoke(); base.Show(); }
static void tstHiding() { //The differences in behavior between Overrider and Hider are demonstrated in the following code: Overrider over = new Overrider(); BaseClass b1 = over; over.Foo(); // Overrider.Foo b1.Foo(); // Overrider.Foo Hider h = new Hider(); BaseClass b2 = h; h.Foo(); // Hider.Foo b2.Foo(); // BaseClass.Foo }
internal void exposeSecret() { Hider.SetActive(false); Secret.SetActive(true); }
static void unregister(Hider cmp) => hiders.Remove(cmp);
static void Main(string[] args) { Stock msft = new Stock { Name = "MSFT", SharesOwned = 1000L }; Console.WriteLine(msft.Name); Console.WriteLine(msft.SharesOwned); Console.WriteLine(msft); House mansion = new House { Name = "Mansion", Mortgage = 250000M }; Console.WriteLine(mansion); Console.WriteLine(mansion.Name); Console.WriteLine(mansion.Mortgage); Console.WriteLine(mansion.Liability); // polymorphism Display(msft); Display(mansion); // Upcast : implicitly upcast to a base class reference Asset a = msft; // True : Console.WriteLine(a == msft); // OK : Console.WriteLine(a.Name); // Error: SharesOwned undefined // Console.WriteLine(a.SharesOwned); // Downcast : explicitly downcast to a subclass reference Stock s = (Stock)a; // <No error> Console.WriteLine(s.SharesOwned); // True : Console.WriteLine(s == a); // True : Console.WriteLine(s == msft); // as operator performs a downcast that evaluates to null (rather than throwing // an exception) if the downcast fails Asset asserNull = new Asset(); Stock t = asserNull as Stock; // t is null; no exception thrown Console.WriteLine(t?.SharesOwned); // new versus override Overrider over = new Overrider(); BaseClass b1 = over; over.Foo(); // Overrider.Foo b1.Foo(); // Overrider.Foo Hider h = new Hider(); BaseClass b2 = h; h.Foo(); // Hider.Foo b2.Foo(); // BaseClass.Foo // Boxing : convert a value-type instance to a reference-type instance int x = 9; // box the int into an object object obj = x; // Unboxing : cast the object back to the original value type // Unboxing : requires an explicit cast int y = (int)obj; x = 5; // changing the value of x doesn’t change its previously boxed copy Console.WriteLine(obj); // 9 }
public override void Initialize(AiClient client) { myHider = (Hider)client; target = myHider.Target.transform.position; base.Initialize(client); }
public override void Initialize(AiClient client) { myHider = (Hider)client; base.Initialize(client); }
static void register(Hider cmp) => hiders.Add(cmp);