Inheritance: MonoBehaviour
Example #1
0
 public void LeaveRange(InteractionHandler handler)
 {
     if (_UsePointer != null)
     {
         _UsePointer.SetActive(false);
     }
 }
Example #2
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            _tracker?.Dispose();
            _tracker = null;
        }
Example #3
0
 // 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());
         }
     }
 }
Example #4
0
 public virtual void LeaveRange(InteractionHandler handler)
 {
     if (OnLeaveRange != null)
     {
         OnLeaveRange.Invoke();
     }
 }
Example #5
0
 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 );
        }
Example #7
0
 private void Start()
 {
     _player                 = GetComponent <Player>();
     _characterDriver        = GetComponent <CharacterDriver>();
     _interactionHandler     = GetComponent <InteractionHandler>();
     _playerControllerPrefix = GetPlayerPrefix(GameControls.Instance.GetPlayerController(_player.Number));
 }
Example #8
0
    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>();
 }
Example #10
0
 void Start()
 {
     player             = GetComponent <Player> ();
     animator           = FindObjectOfType <AnimationHandler>();
     curentState        = PlayerState.Normal;
     interactionHandler = FindObjectOfType <InteractionHandler>();
     playerController   = GetComponent <Controller2D>();
 }
Example #11
0
 public void Interact(InteractionHandler handler)
 {
     if (handler != null)
     {
         handler.GetComponentInParent <ItemHandler>().OnPickup(associatedItem);
         DestroyObject();
     }
 }
Example #12
0
    // Use this for initialization
    public override void Awake()
    {
        base.Awake();

        _IM           = GetComponent <InputManager>();
        _InteractionH = GetComponentInChildren <InteractionHandler>();
        _ItemH        = GetComponentInChildren <ItemHandler>();
    }
Example #13
0
    /// <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>();
    }
Example #14
0
 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);
 }
Example #15
0
 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>();
    }
Example #17
0
 public void OnHelicopterTriggerEnter(InteractionHandler interactor)
 {
     if (interactor != null)
     {
         NumOfPlayersInRange++;
         CurrentInteractor = interactor;
         this.enabled      = true;
     }
 }
Example #18
0
    // Use this for initialization
    void Start()
    {
        GetComponent <LineRenderer>().SetPosition(0, startPt);
        GetComponent <LineRenderer>().SetPosition(1, endPt);

        arrowTip = InitArrowTip();

        scene = GameObject.FindObjectOfType <InteractionHandler>();
    }
Example #19
0
    void Start()
    {
        wandLeft  = controllerGameObjectLeft.GetComponent <SteamVR_TestThrow>();
        wandRayL  = controllerGameObjectLeft.GetComponent <WandRay>();
        wandRight = controllerGameObjectRight.GetComponent <SteamVR_TestThrow>();
        wandRayR  = controllerGameObjectLeft.GetComponent <WandRay>();

        myInteractionHandler = sceneGod.GetComponent <InteractionHandler>();
    }
Example #20
0
    /// <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;
    }
Example #21
0
        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);
        }
Example #22
0
    protected virtual void Awake()
    {
        rigid    = GetComponent <Rigidbody2D>();
        Animator = GetComponent <Animator>();

        InteractionHandler                = GetComponent <InteractionHandler>();
        InteractionHandler.ClashAction    = OnClash;
        InteractionHandler.HitEnemyAction = OnHitEnemy;
    }
Example #23
0
        // 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]);
            }
        }
Example #24
0
 public void OnHelicopterTriggerExit(InteractionHandler interactor)
 {
     if (interactor != null)
     {
         interactor.RemoveInteractionPanel();
         NumOfPlayersInRange--;
     }
     CurrentInteractor = null;
     this.enabled      = false;
 }
Example #25
0
    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);
     }
 }
Example #27
0
    private void RpcSitOnConveyance(GameObject con)
    {
        if (!isLocalPlayer)
        {
            return;
        }

        m_ConveyanceAttachedTo = con;
        GetComponentInChildren <AudioListener>().enabled = false;
        m_InteractHandler = m_ConveyanceAttachedTo.GetComponent <InteractionHandler>();
    }
Example #28
0
 public virtual void UseItemOnStation(InteractionHandler handler, Item itemToUse)
 {
     if (OnUseItem != null)
     {
         OnUseItem.Invoke();
     }
     canAct = false;
     if (OnLeaveRange != null)
     {
         OnLeaveRange.Invoke();
     }
 }
Example #29
0
 public override void Interact(InteractionHandler handler)
 {
     base.Interact(handler);
     if (_CannonShoot.lockedAndReady)
     {
         _CannonShoot.OnShoot();
     }
     else
     {
         _CannonShoot.OnFailedShoot();
     }
 }
Example #30
0
 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));
Example #32
0
 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
     }
 }
Example #33
0
 public Interaction(InteractionHandler h, string t)
 {
     handler = h;
     text = t;
 }
Example #34
0
        // 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();
        }