public void LeaveRange(InteractionHandler handler) { if (_UsePointer != null) { _UsePointer.SetActive(false); } }
protected override void OnDestroy() { base.OnDestroy(); _tracker?.Dispose(); _tracker = null; }
// Update is called once per frame void Update() { if (_input.x < INPUT_TOLERANCE && _input.x > INPUT_TOLERANCE * -1 && _input.y < INPUT_TOLERANCE && _input.y > INPUT_TOLERANCE * -1) { if (_charge != 0) { _shooting = true; RaycastHit2D[] hits = Physics2D.CircleCastAll(transform.position, 0.5f, _lastInput * -1, 2f); if (hits != null && hits.Length > 0) { foreach (RaycastHit2D hit in hits) { if (hit.transform != this.transform) { InteractionHandler interactionHandler = hit.transform.GetComponent <InteractionHandler>(); if (interactionHandler != null) { interactionHandler.GetPunched(_charge * chargeEffectMultiplier); } } } } _charge = 0; } } else { _lastInput = _input; if (_charge == 0) { _charge += chargeSpeed; StartCoroutine(ChargeShot()); } } }
public virtual void LeaveRange(InteractionHandler handler) { if (OnLeaveRange != null) { OnLeaveRange.Invoke(); } }
public void OnRange(InteractionHandler handler) { if (_UsePointer != null) { _UsePointer.SetActive(true); } }
private Axis yAxis2ZoomCache_; // zooming, etc #endregion Fields #region Constructors /// <summary> /// Default constructor. /// </summary> public InteractivePlotSurface2D() : base() { // Create empty InteractionOccurred and PreRefresh Event handlers InteractionOccurred += new InteractionHandler (OnInteractionOccurred); PreRefresh += new PreRefreshHandler( OnPreRefresh ); }
private void Start() { _player = GetComponent <Player>(); _characterDriver = GetComponent <CharacterDriver>(); _interactionHandler = GetComponent <InteractionHandler>(); _playerControllerPrefix = GetPlayerPrefix(GameControls.Instance.GetPlayerController(_player.Number)); }
public IEnumerator StayOnBoard() { yield return(new WaitForSeconds(InteractionHandler.GetInstance().DecisionFieldAliveTime + 3)); // Todo Play Animation or just deactivate field; gameObject.SetActive(false); }
public void Start() { interactionHandler = GetComponent <InteractionHandler>(); curentState = PlayerState.Normal; _rb = GetComponent <Rigidbody2D>(); _CharacterController = GetComponent <CharacterController2D>(); }
void Start() { player = GetComponent <Player> (); animator = FindObjectOfType <AnimationHandler>(); curentState = PlayerState.Normal; interactionHandler = FindObjectOfType <InteractionHandler>(); playerController = GetComponent <Controller2D>(); }
public void Interact(InteractionHandler handler) { if (handler != null) { handler.GetComponentInParent <ItemHandler>().OnPickup(associatedItem); DestroyObject(); } }
// Use this for initialization public override void Awake() { base.Awake(); _IM = GetComponent <InputManager>(); _InteractionH = GetComponentInChildren <InteractionHandler>(); _ItemH = GetComponentInChildren <ItemHandler>(); }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { /// Connect interactionManager to the Interaction Manager game object. interactionManager = GameObject.Find("Interaction Handler"); /// Connect scriptReference to the ARTapToPlace script on interactionManager. scriptReference = interactionManager.GetComponent <InteractionHandler>(); }
public PlotCanvas() : base() { // Create Drawing Surface with a reference to this PlotCanvas canvas = new DrawingSurface(this); // Create empty InteractionOccurred and PreRefresh Event handlers InteractionOccurred += new InteractionHandler(OnInteractionOccurred); PreRefresh += new PreRefreshHandler(OnPreRefresh); }
public virtual void OnRange(InteractionHandler handler) { //Debug.Log("Entered Range"); if (OnEnterRange != null && canAct) { OnEnterRange.Invoke(); } }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { /// Connect _interactionHandler to the Interaction Manager game object. _interactionHandler = GameObject.Find("Interaction Handler"); /// Connect _scriptReference to the InteractionHandler script on _interactionHandler. _scriptReference = _interactionHandler.GetComponent <InteractionHandler>(); }
public void OnHelicopterTriggerEnter(InteractionHandler interactor) { if (interactor != null) { NumOfPlayersInRange++; CurrentInteractor = interactor; this.enabled = true; } }
// Use this for initialization void Start() { GetComponent <LineRenderer>().SetPosition(0, startPt); GetComponent <LineRenderer>().SetPosition(1, endPt); arrowTip = InitArrowTip(); scene = GameObject.FindObjectOfType <InteractionHandler>(); }
void Start() { wandLeft = controllerGameObjectLeft.GetComponent <SteamVR_TestThrow>(); wandRayL = controllerGameObjectLeft.GetComponent <WandRay>(); wandRight = controllerGameObjectRight.GetComponent <SteamVR_TestThrow>(); wandRayR = controllerGameObjectLeft.GetComponent <WandRay>(); myInteractionHandler = sceneGod.GetComponent <InteractionHandler>(); }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { /// Link the InteractionHandler script to _interactionHandler. _interactionHandler = GameObject.Find("Interaction Handler") .GetComponent <InteractionHandler>(); /// Assume no buttons have been disabled. _hasDisabledButtons = false; }
private Axis yAxis2Cache; // zooming, panning, etc #endregion Fields #region Constructors public PlotCanvas() : base() { // Create Drawing Surface with a reference to this PlotCanvas canvas = new DrawingSurface (this); // Create empty InteractionOccurred and PreRefresh Event handlers InteractionOccurred += new InteractionHandler (OnInteractionOccurred); PreRefresh += new PreRefreshHandler (OnPreRefresh); }
protected virtual void Awake() { rigid = GetComponent <Rigidbody2D>(); Animator = GetComponent <Animator>(); InteractionHandler = GetComponent <InteractionHandler>(); InteractionHandler.ClashAction = OnClash; InteractionHandler.HitEnemyAction = OnHitEnemy; }
// Set the reactions to the given interaction type. // The reaction functions are called in the order they are specified. protected void SetReaction(InteractionType type, params InteractionMemberDelegate[] reactions) { InteractionHandler handler = GetInteraction(type); handler.Clear(); for (int i = 0; i < reactions.Length; i++) { handler.Add(reactions[i]); } }
public void OnHelicopterTriggerExit(InteractionHandler interactor) { if (interactor != null) { interactor.RemoveInteractionPanel(); NumOfPlayersInRange--; } CurrentInteractor = null; this.enabled = false; }
protected override void Start() { base.Start(); Globe = GameObject.Find("Globe"); GetComponent <VRTK_ControllerEvents>().TriggerPressed += new ControllerInteractionEventHandler(grabInit); GetComponent <VRTK_ControllerEvents>().TriggerReleased += new ControllerInteractionEventHandler(grabDeinit); ih = GameObject.FindObjectOfType <InteractionHandler>(); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void RpcSitOnConveyance(GameObject con) { if (!isLocalPlayer) { return; } m_ConveyanceAttachedTo = con; GetComponentInChildren <AudioListener>().enabled = false; m_InteractHandler = m_ConveyanceAttachedTo.GetComponent <InteractionHandler>(); }
public virtual void UseItemOnStation(InteractionHandler handler, Item itemToUse) { if (OnUseItem != null) { OnUseItem.Invoke(); } canAct = false; if (OnLeaveRange != null) { OnLeaveRange.Invoke(); } }
public override void Interact(InteractionHandler handler) { base.Interact(handler); if (_CannonShoot.lockedAndReady) { _CannonShoot.OnShoot(); } else { _CannonShoot.OnFailedShoot(); } }
public virtual void Interact(InteractionHandler handler) { if (OnInteract != null) { OnInteract.Invoke(); } canAct = false; if (OnLeaveRange != null) { OnLeaveRange.Invoke(); } }
private void OnHitboxEnteredHurtboxEvent(Hitbox hitbox, Hitbox hurtbox) { print(hitbox.name + " " + hurtbox.name + " entered!"); InteractionHandler hitInteraction = hitbox.associatedInteractionHandler; InteractionHandler hurtInteraction = hurtbox.associatedInteractionHandler; // If the hitbox for this move allows multi hit, then we can register another hit on this frame. // If not, only register a hit if the move has not already hit the player. // TODO Replace HitBox.AllowMultiHit with (CharacterMove).MultiHit // Assuming we want to keep move properties in a if (hurtInteraction && hurtInteraction && !hitInteraction.CharactersHit.Contains(hurtInteraction)) { hurtInteraction.OnHitByEnemy(hurtbox, hitbox, hitInteraction && hitInteraction ? hitInteraction.CurrentMove : (default));
public new void Interact(InteractionHandler handler) { base.Interact(handler); if (handler != null) { handler.GetComponentInParent <ItemHandler>().OnPickup(itemToDispense); if (OnItemDispense != null) { OnItemDispense.Invoke(); } ammo = usesAmmo ? ammo-- : ammo; // TO DO AMMO SYSTEM } }
public Interaction(InteractionHandler h, string t) { handler = h; text = t; }
// States. /*private MonsterBurnState stateBurn; private MonsterStunState stateStun; private MonsterFallInHoleState stateFallInHole; private MonsterGaleState stateGale;*/ //----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public Monster() { // With player: // - Top: 4 overlap // - Bottom: 3 overlap? // - Sides: 3 overlap color = MonsterColor.Red; properties = new Properties(); // Physics. Physics.CollisionBox = new Rectangle2I(-5, -9, 10, 10); Physics.SoftCollisionBox = new Rectangle2I(-6, -11, 12, 11); Physics.CollideWithWorld = true; Physics.CollideWithRoomEdge = true; Physics.AutoDodges = true; Physics.HasGravity = true; Physics.IsDestroyedInHoles = true; // Graphics. Graphics.DepthLayer = DepthLayer.Monsters; Graphics.DepthLayerInAir = DepthLayer.InAirMonsters; Graphics.DrawOffset = new Point2I(-8, -14); centerOffset = new Point2I(0, -6); // Monster & unit settings. knockbackSpeed = GameSettings.MONSTER_KNOCKBACK_SPEED; hurtKnockbackDuration = GameSettings.MONSTER_HURT_KNOCKBACK_DURATION; bumpKnockbackDuration = GameSettings.MONSTER_BUMP_KNOCKBACK_DURATION; hurtInvincibleDuration = GameSettings.MONSTER_HURT_INVINCIBLE_DURATION; hurtFlickerDuration = GameSettings.MONSTER_HURT_FLICKER_DURATION; contactDamage = 1; isGaleable = true; isBurnable = true; isStunnable = true; isKnockbackable = true; softKill = false; // Setup default interactions. interactionHandlers = new InteractionHandler[(int) InteractionType.Count]; for (int i = 0; i < (int) InteractionType.Count; i++) interactionHandlers[i] = new InteractionHandler(); SetDefaultReactions(); }