Exemple #1
0
 private void Awake()
 {
     _characterController = GetComponent <CharacterController>();
     _selfTargetable      = GetComponent <Targetable>();
     _colliders           = GetComponents <Collider>();
     _interactSystem      = GetComponent <InteractSystem>();
 }
 /// <summary>
 /// When a character interacts with this object, toggle the trigger
 /// </summary>
 /// <param name="_system"></param>
 public override void Interact(InteractSystem _system)
 {
     trigger.Trigger();
     // if it's an one shot trigger, disables the interaction
     if (trigger.oneShot)
     {
         interactable = !trigger.Active;
     }
 }
Exemple #3
0
 /// <summary>
 /// When interacted with, the object will attach itself to the character and disable its collisions
 /// </summary>
 /// <param name="_system">The character that interacted with this object</param>
 public override void Interact(InteractSystem _system)
 {
     system = _system;
     system.PickedUpObject = this;
     transform.position    = system.transform.position + (Vector3)system.pickupPositionOffset;
     oldParent             = transform.parent;
     transform.parent      = system.transform;
     Controller.enabled    = false;
     GetComponent <Collider2D>().enabled = false;
 }
    protected override void Awake()
    {
        base.Awake();
        movement     = GetComponent <PlayerMovement> ();
        weaponSystem = GetComponent <PlayerWeaponSystem> ();
        swipe        = GetComponent <SwipeManager> ();
        GameObject tempUI = GameObject.FindGameObjectWithTag("UI");

        if (tempUI)
        {
            ui = tempUI.GetComponent <PlayerUI> ();
        }
        interact = GetComponent <InteractSystem>();
    }
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     character        = GetComponent <CharacterController2D>();
     checkpoint       = GetComponent <CheckpointSystem>();
     interact         = GetComponent <InteractSystem>();
     cameraController = GameObject.FindObjectOfType <CameraController>();
     if (!cameraController)
     {
         Debug.LogError("The scene is missing a camera controller! The player script needs it to work properly!");
     }
     controls.Player.Movement.performed += ctx => Move(ctx.ReadValue <Vector2>());
     controls.Player.Movement.cancelled += ctx => Move(Vector2.zero);
     controls.Player.Jump.started       += Jump;
     controls.Player.Jump.cancelled     += EndJump;
     controls.Player.Dash.started       += Dash;
     controls.Player.Interact.started   += Interact;
     controls.Player.AttackA.started    += Attack;
 }
 public abstract void Interact(InteractSystem _system);
Exemple #7
0
 private void SetupInteractSystems()
 {
     m_InteractSystem = Resources.Load <InteractSystem>("InteractSystem");
     m_InteractSystem.SetupSystem(Camera.main);
     m_NoInteractSystem = Resources.Load <NoInteractSystem>("NoInteractSystem");
 }