コード例 #1
0
ファイル: Turret.cs プロジェクト: zvolchak/TrappedEscape
    }     //Update

    public void CheckTarget()
    {
        //FIXME: Add Solid layer mask to the raycast!
        this.visionRay = Physics2D.Raycast(this.transform.position, VisionVector.normalized, VisionDistance, TargetLayer);

        if (!this.visionRay)
        {
            return;
        }

        if (IgnoreTags.Contains(this.visionRay.collider.tag))
        {
            return;
        }

        if (!bHasSpotted)
        {
            if (TargetSpottedEffect != null)
            {
                TargetSpottedEffect.PlayParticles(TargetSpottedEffect.transform.position);
            }
            bHasSpotted = true;
        }

        if (!bIsTurningOn)
        {
            this.timeSinceLastVision = Time.timeSinceLevelLoad;
        }
    }//CheckTarget
コード例 #2
0
ファイル: DashAbility.cs プロジェクト: zvolchak/TrappedEscape
        }//Update


        public override Vector2 Use(Vector2 deltaMovement) {
            if (!IsCanDash)
                return deltaMovement;

            if (Input.GetButtonDown(InputName))
                PressButton();

            if (!IsDashing)
                return deltaMovement;

            float direction = ActorCmp.transform.localScale.x;
            direction = Mathf.Sign(direction);

            IsDashing = true;
            if (this.Props.CurrDashTime == -1) { //not dashing yet
                //FIXME: called for Player.Instance! GARBAGE
                //Player.Instance.GetComponent<CharacterAnimator>().AnimatorCmp.SetTrigger(this.AnimationState);
                this.Props.CurrDashTime = 0f;
                this.startSpeed = deltaMovement.x;
            }

            deltaMovement.x = startSpeed + this.Props.Force * direction;
            deltaMovement.y = 0f;

            PlaySoundEffect();
            if (!bIsParticlesPlayed) {
                if (DashEffects != null) {
                    DashEffects.PlayParticles(this.transform.position, -ActorCmp.transform.localScale.x);
                    bIsParticlesPlayed = true;
                }
            }//if particles

            bIsNeedReset = true;

            this.EOnUse?.Invoke(this);
            return deltaMovement;
        }//UseAbility