public virtual bool TryInteract(LinkBeam linkBeam) { if (linkBeam.Strength >= _toughness) { if ((!Activated || !_permanent) && !_hitTimer.Active) { Activated = true; _hitTimer.Activate(); if (_playSoundWhenActivated) { if (!_hasPlayedActivateSound) { SFXPlayer.Instance.Play(_activateSound, volumeFactor: _volumeFactor); _hasPlayedActivateSound = true; } } return(true); } } return(false); }
public bool HandleActionInput() { bool inputHeld = false; bool inputjustReleased = false; Input.GetActionInput(out inputHeld, out inputjustReleased); bool result = false; if (LinkBeam != null) { if (inputjustReleased) { if (!IsLinkTarget) { // TODO: Can the link beam link also to certain level objects? LinkBeam.Activate(!LinkBeam.Active, _otherPlayer); } else { LinkedLinkBeam.Activate(false); } } // Starts link start-up/shutdown animation //Animator.SetBool("Link Active", Link.Active); result = LinkBeam.Active; } return(result); }
protected virtual void AttachToBeam(bool attach, LinkBeam linkBeam = null) { if (AttachedToBeam != attach) { if (!attach && TargetLinkBeam != null) { TargetLinkBeam.linkInteractables.Remove(this); FallToGround(); } AttachedToBeam = attach; TargetLinkBeam = linkBeam; _toughnessLeft = _toughness; _speed = _defaultSpeed; _hitTimer.Reset(); if (attach) { linkBeam.linkInteractables.Add(this); if (_playSoundWhenAttachedToBeam) { SFXPlayer.Instance.Play(_attachSound, volumeFactor: _volumeFactor); } } else if (_playSoundWhenDetachedFromBeam) { SFXPlayer.Instance.Play(_detachSound, volumeFactor: _volumeFactor); } } }
protected virtual void AttachToBeam(bool attach, LinkBeam linkBeam = null) { if (AttachedToBeam != attach) { //if (attach) //{ // Debug.Log("Attached to " + linkBeam.Player.name + "'s beam"); //} //else //{ // Debug.Log("Detached from " + TargetLinkBeam.Player.name + "'s beam"); //} if (!attach && TargetLinkBeam != null) { TargetLinkBeam.linkInteractables.Remove(this); } AttachedToBeam = attach; TargetLinkBeam = linkBeam; _toughnessLeft = _toughness; _speed = _defaultSpeed; _moveForward = true; // TODO _hitTimer.Reset(); if (attach) { linkBeam.linkInteractables.Add(this); } } }
/// <summary> /// Starts moving the object. /// </summary> public void StartMoving(LinkBeam linkBeam, Vector3 currentPosition) { this.linkBeam = linkBeam; position = currentPosition; isMoving = true; beamReached = false; }
/// <summary> /// Initializes the object. /// </summary> private void Start() { if (_player1SpawnPoint == null) { Debug.LogError(Utils.GetFieldNullString("Player 1 spawn point")); } if (_player2SpawnPoint == null) { Debug.LogError(Utils.GetFieldNullString("Player 2 spawn point")); } _ui = GameManager.Instance.GetUI(); _currentLevel = GameManager.Instance.CurrentLevel; _ui.levelName.text = _currentLevel.LevelName; _levelTimer = new Timer(_levelTime, true); _hurryUpWarnTimer = new Timer(_hurryUpWarnFlashTime, true); _scoreMultDecayTimer = new Timer(_scoreMultiplierDecayTime, true); _lb = FindObjectOfType <LinkBeam>(); orichalcumPickupPool = new Pool <OrichalcumPickup>(128, true, orichalcumPickupPrefab); stoneDebrisPool = new Pool <Debris>(128, true, stoneDebrisPrefabArray); woodDebrisPool = new Pool <Debris>(64, true, woodDebrisPrefabArray); terracottaDebrisPool = new Pool <Debris>(128, true, terracottaDebrisPrefabArray); }
public bool TryInteract(LinkBeam linkBeam) { if (!mtb.isMoving) { mtb.StartMoving(linkBeam, _movableObject.position); } return(true); }
public bool TryInteract(LinkBeam linkBeam) { if (!mtb.isMoving) { mtb.StartMoving(linkBeam, transform.position); } return(true); }
public virtual bool TryInteractInstant(LinkBeam linkBeam) { if (!IsDestroyed && linkBeam.Strength >= _toughness) { Destroy(); return(true); } return(false); }
/// <summary> /// Initializes the object. /// </summary> protected override void Start() { base.Start(); LinkBeam = GetComponentInChildren <LinkBeam>(); LinkBeam.Init(this, ActivateShield); LinkObject = LinkBeam.gameObject; Animator = GetComponentInChildren <Animator>(); ShieldAnimator = ShieldModel.GetComponent <Animator>(); _otherPlayer = GameManager.Instance.GetAnyOtherPlayer(this, true); }
public bool TryInteractInstant(LinkBeam linkBeam) { if (linkBeam.Strength >= _toughness) { _toughnessLeft = 0f; Collect(linkBeam.Player); return(true); } return(false); }
public virtual bool TryInteractInstant(LinkBeam linkBeam) { if (linkBeam.Strength >= _toughness) { _toughnessLeft = 0f; AttachToBeam(true, linkBeam); return(true); } return(false); }
/// <summary> /// Resets things common to both ResetBaseValues() and CancelActions(). /// </summary> private void ResetCommon() { IsLinkTarget = false; LinkedLinkBeam = null; Jumping = false; Respawning = false; if (LinkBeam != null) { LinkBeam.ResetLinkBeam(); } }
public bool HandleAltActionInput() { bool active = Input.GetAltActionInput(); bool result = false; if (active && BeamOn) { if (LinkBeam != null) { LinkBeam.Pulse(); } } return(result); }
public virtual bool TryInteract(LinkBeam linkBeam) { if (available && !AttachedToBeam && !_hitTimer.Active) { _toughnessLeft -= linkBeam.Strength; if (_toughnessLeft <= 0f) { _toughnessLeft = 0f; AttachToBeam(true, linkBeam); return(true); } else { _hitTimer.Activate(); } } return(false); }
public virtual bool TryInteract(LinkBeam linkBeam) { if (!IsDestroyed && !_hitTimer.Active) { //Debug.Log("collectStrength: " + collectStrength); _toughnessLeft -= linkBeam.Strength; if (_toughnessLeft <= 0f) { Destroy(); return(true); } else { _hitTimer.Activate(); if (_regenMode != ToughnessRegenMode.Off) { _regenTimer.Activate(); } } } return(false); }
public virtual bool TryInteractInstant(LinkBeam linkBeam) { return(TryInteract(linkBeam)); }
/// <summary> /// Stops moving the object. /// </summary> public void StopMoving() { linkBeam = null; isMoving = false; beamReached = false; }
public bool GivePulse(LinkBeam linkBeam, float speedModifier) { return(false); }
public bool TryInteractInstant(LinkBeam linkBeam) { return(false); }
public bool TryInteract(LinkBeam linkBeam) { return(TryInteract(linkBeam.Player, linkBeam.Strength)); }
public bool GivePulse(LinkBeam linkBeam, float speedModifier) { _speed = Mathf.Abs(_defaultSpeed * speedModifier); SetDirection(speedModifier > 0f); return(true); }