Esempio n. 1
0
        private void OnUpdate(EventArgs args)
        {
            if (!Enabled || !Game.IsInGame || Game.CurrentMatchState != MatchState.InRound || (LocalPlayer.Instance.CharName != "Shen Rao" && !string.IsNullOrEmpty(LocalPlayer.Instance.CharName)))
            {
                return;
            }

            if (MenuHandler.UseSkill(AbilitySlot.Ability6) && AbilitySlot.Ability6.IsReady() &&
                LocalPlayer.Instance.Energized.Energy >= 25 && LocalPlayer.Instance.Living.MaxRecoveryHealth - LocalPlayer.Instance.Living.Health >= 22)
            {
                LocalPlayer.PressAbility(AbilitySlot.Ability6, true);
                return;
            }

            if (LocalPlayer.Instance.AbilitySystem.IsCasting && !LocalPlayer.Instance.AbilitySystem.IsPostCasting)
            {
                if (_combo || MenuHandler.AimUserInput)
                {
                    Aiming.GetTargetAndAim();
                }
            }
            else if (_combo && HasUltBuff())
            {
                //ult logic?
            }
            else if (_combo && (!LocalPlayer.Instance.AbilitySystem.IsCasting || LocalPlayer.Instance.AbilitySystem.IsPostCasting))
            {
                Casting.CastLogic();
            }
        }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     shoot      = transform.GetChild(0).GetComponent <ShootScript>();
     aim        = transform.GetChild(0).GetChild(0).GetComponent <Aiming>();
     controller = GetComponent <FirstPersonController>();
     mapCam     = GameObject.Find("MapCamera").GetComponent <Camera>();
 }
Esempio n. 3
0
    IEnumerator DeathAnimation(GameObject boat)
    {
        //turns off scripts for player action
        Aiming      aim   = boat.GetComponentInChildren <Aiming>();
        Shooting    shoot = boat.GetComponentInChildren <Shooting>();
        MovePlayer1 move  = boat.GetComponent <MovePlayer1>();

        aim.enabled   = !aim.enabled;
        move.enabled  = !move.enabled;
        shoot.enabled = !shoot.enabled;

        //stops bgm and starts death sound
        GameManager.aud.Stop();
        GameManager.aud.PlayOneShot(death);

        //plays death animation
        for (int i = 0; i < 50; i++)
        {
            yield return(new WaitForEndOfFrame());

            boat.transform.eulerAngles = boat.transform.eulerAngles + new Vector3(0f, 0f, 18.1f); //rotates object
            boat.transform.localScale  = boat.transform.localScale - new Vector3(.11f, .11f, 0f); //shrinks object
        }
        SceneManager.LoadScene(2);                                                                //loads death scene
    }
Esempio n. 4
0
 public void Initialize()
 {
     IWM = GetComponentInParent <ImprovedWeaponManager>();
     //chargedArea = gameObject.GetComponentInChildren<ChargedLaserArea>();
     aim           = GameObject.FindGameObjectWithTag("TPCamera").GetComponent <Aiming>();
     chargedDamage = initChargedDamage;
     //chargedArea.Initialize();
 }
 // Use this for initialization
 void Start()
 {
     disable       = GetComponent <DisableOtherScripts> ();
     player_num    = GetComponent <Movement> ().player_num;
     player_camera = GetComponentInChildren <Camera> ().gameObject;
     aimingScript  = GetComponent <Aiming> ();
     rb            = GetComponent <Rigidbody> ();
 }
Esempio n. 6
0
 public DifficultyCalculator()
 {
     Aiming   = new Aiming();
     Clicking = new Clicking();
     Reading  = new Reading();
     Skills.Add(Aiming);
     Skills.Add(Clicking);
     Skills.Add(Reading);
 }
Esempio n. 7
0
 void Start()
 {
     messageText = messageTextGameObject.GetComponent <Text>();
     messageGameObject.SetActive(false);
     mensajeSalteableBotonObjeto.SetActive(false);
     cam      = FindObjectOfType <Camera_Controller>();
     aim      = FindObjectOfType <Aiming>();
     descript = FindObjectOfType <Setexts>();
 }
    // Start is called before the first frame update
    void Start()
    {
        weaponHandler = GetComponent <Aiming>();
        equipment     = GetComponent <Equipment>();
        RaycastWeapon existingWeapon = GetComponentInChildren <RaycastWeapon>();

        if (existingWeapon)
        {
            Equip(existingWeapon);
        }
    }
Esempio n. 9
0
    //ActivateCannon active;

    // Use this for initialization
    void Start()
    {
        shooting    = GetComponent <Shooting> ();
        movement    = GetComponent <Movement> ();
        collectSnow = GetComponent <CollectSnow> ();
        collectFort = GetComponent <CollectSnowFort> ();
        aiming      = GetComponent <Aiming> ();
        rb          = GetComponent <Rigidbody>();
        heal        = GetComponent <HealSnowmanProximity>();
        //active = GetComponent<ActivateCannon> ();
    }
Esempio n. 10
0
    private void Start()
    {
        if (instance == null)
        {
            instance = this;
        }

        Bullet.moveSpeed = 5;
        NumberGun        = 0;
        joystickBG       = transform.GetChild(0).GetComponent <Image>();
    }
Esempio n. 11
0
    /// <summary>
    /// 背景オブジェクトの有効化
    /// </summary>
    protected void Activate_Background()
    {
        MeshRenderer mr = InstantiateBackgroundObject();

        mr.material.color = symbolColor;
        //追尾設定
        Aiming aiming = mr.gameObject.GetComponent <Aiming>();

        aiming.SetTarget(gameObject, new Vector3(0f, 0f, collisionRadius * 2f));
        //レンダラの登録
        backgroundObjectRenderer = mr;
    }
Esempio n. 12
0
    /// <summary>
    /// Устанавить позицию
    /// </summary>
    private void SetBubblePosition(Vector2 tensionPos)
    {
        //Ограничение позиции натяжения
        _tensionPos = _startPos - Vector2.ClampMagnitude(_startPos - tensionPos, shootInfo.maxAimingRadius);


        Bubble.RigidBody.MovePosition(_tensionPos);
        //Отправляем параметры прицеливания
        Aiming?.Invoke(_tensionPos,
                       shootInfo.maxStartVelocity / shootInfo.maxAimingRadius * (_startPos - _tensionPos),
                       Bubble.Collider.radius * _tr.localScale.x);
    }
Esempio n. 13
0
    void UpdateDashDirection()
    {
        Aiming aim = GetComponentInChildren <Aiming>();

        if (aim.isLeftFacing() && currState != MovementState.Dash)
        {
            dashDirection = Direction.Left;
        }
        else if (currState != MovementState.Dash)
        {
            dashDirection = Direction.Right;
        }
    }
Esempio n. 14
0
 void OnEnable()
 {
     fireCount        = fireRate;
     audioSource      = GetComponent <AudioSource>();
     aim              = transform.GetChild(0).GetComponent <Aiming>();
     weaponManagement = transform.GetChild(0).GetChild(0).GetComponent <WeaponManagement>();
     GetComponent <AudioSource>().enabled = true;
     GetComponent <Camera>().enabled      = true;
     transform.Find("ClipingCam").gameObject.SetActive(true);
     transform.Find("WeaponSlot").gameObject.GetComponent <Aiming>().enabled = true;
     transform.Find("WeaponSlot").gameObject.layer = LayerMask.NameToLayer("MainWeapon");
     playerDatas    = transform.parent.GetComponent <PlayerDatas>();
     playerNetAgent = transform.parent.GetComponent <PlayerNetworkAgent>();
 }
Esempio n. 15
0
        public ExtendedView(Settings settings,
            GameState gameState,
			ITobiiTracker tobiiTracker,
            Aiming aiming,
            DebugOutput debugOutput
            )
        {
            _settings = settings;
            _gameState = gameState;
            _aiming = aiming;
            _debugOutput = debugOutput;
            _tobiiTracker = tobiiTracker;

            _aimTransitionState = 1;

            _extendedViewCamera = World.CreateCamera(new Vector3(), Vector3.Zero, 60f);
            _forwardCamera = World.CreateCamera(new Vector3(), Vector3.Zero, 60f);
        }
Esempio n. 16
0
    void Start() ///initialise start game variables and attach links to other scripts needed for interaction
    {
        throwCharge = minThrowForce;

        rb = GetComponent <Rigidbody>();

        rb.velocity = Vector3.zero;

        velocityChange = rb.velocity;

        aim = GameObject.FindGameObjectWithTag("Arrow").GetComponent <Aiming>();

        aim.gameObject.SetActive(false);

        anim = GetComponent <Animator>(); //get the animator component

        sound = GetComponent <AudioSource>();
    }
Esempio n. 17
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.name == "End")
        {
            collision.GetComponent <EndGame>().OnGameEnd();
        }

        if (collision.name == "AK-47")
        {
            Transform gun = collision.gameObject.transform;
            gun.SetParent(rb2d.transform, false);
            gun.transform.position             = new Vector3(rb2d.transform.position.x + 0.2f, rb2d.transform.position.y - 0.3f, 0);
            gun.transform.rotation             = Quaternion.identity;
            gun.transform.transform.localScale = new Vector3(2, 2, 0);
            Aiming aiming = rb2d.gameObject.GetComponent <Aiming>();
            aiming.enabled = true;
        }
    }
Esempio n. 18
0
 private void OnUpdate(EventArgs args)
 {
     if (!Enabled || !Game.IsInGame || Game.CurrentMatchState != MatchState.InRound || LocalPlayer.Instance.CharName != "Jumong")
     {
         DebugOutput = "";
         return;
     }
     if (LocalPlayer.Instance.AbilitySystem.IsCasting && !LocalPlayer.Instance.AbilitySystem.IsPostCasting)
     {
         if (_combo || MenuHandler.AimUserInput)
         {
             Aiming.GetTargetAndAim();
         }
     }
     else if (_combo && (!LocalPlayer.Instance.AbilitySystem.IsCasting || LocalPlayer.Instance.AbilitySystem.IsPostCasting))
     {
         Casting.CastLogic();
     }
 }
Esempio n. 19
0
    public void Aim(Aiming aimingType)
    {
        Vector3 rot;

        switch (aimingType)
        {
        case Aiming.UPRIGHT:
            rot = aimingUpRight;
            break;

        case Aiming.UPLEFT:
            rot = aimingUpLeft;
            break;

        case Aiming.DOWNRIGHT:
            rot = aimingDownRight;
            break;

        case Aiming.DOWNLEFT:
            rot = aimingDownLeft;
            break;

        case Aiming.LEFT:
            rot = aimingLeft;
            break;

        case Aiming.RIGHT:
            rot = aimingRight;
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(aimingType), aimingType, null);
        }

        transform.rotation = Quaternion.Euler(rot);
    }
Esempio n. 20
0
 private void Start()
 {
     GetAimingScript = GetComponent <Aiming>();
     currentPower    = maximumPower; // Initialize Unit Health
     spriteRenderer  = GetComponent <SpriteRenderer>();
 }
        public void fire(string animName, Facing facing, Aiming aiming, ProjectileType projType)
        {
            Vector2 shootPoint = AnimationController.getShootPoint(this.DrawPosition);
            Vector2 projDirection = Vector2.Zero;
            if (!animName.Contains("Hold"))
            {
                if (facing == Facing.Left)
                {
                    projDirection.X -= 1;
                }
                else if (facing == Facing.Right)
                {
                    projDirection.X += 1;
                }
            }
            if (aiming == Aiming.Up)
            {
                projDirection.Y -= 1;
            }
            else if (aiming == Aiming.Down)
            {
                projDirection.Y += 1;
            }

            ProjectileController projectile;
            switch (projType)
            {
                case ProjectileType.Missile:
                    if (MissileCount < 1) return;
                    MissileCount -= 1;
                    projectile = new MissileController(
                        this,
                        shootPoint,
                        m_previousVelocity,
                        projDirection);
                    break;
                case ProjectileType.Bullet:
                default:
                    projectile = new BulletController(
                        this,
                        shootPoint,
                        m_previousVelocity,
                        projDirection);
                    break;
            }

            GameplayManager.ActiveZone.add(projectile);
        }
        protected override void updateInternal()
        {
            if (!roomsVisited.Contains(GameplayManager.ActiveZone.TopLeftPosition))
            {
                roomsVisited.Add(GameplayManager.ActiveZone.TopLeftPosition);
                this.model.setStat("roomsVisited", this.model.getStat("roomsVisited") + 1);
            }

            #region Gather Movement Inputs

            if (!IsAirborne && InputSet.getInstance().getButton(InputsEnum.BUTTON_1) &&
                (m_previousHeight != Height.Ball || Inventory.HasItem(Item.SpringBall)))
            {
                m_attemptedVelocity.Y -= 40;
            }

            // Debug movement, flies through stuff
            if (InputSet.getInstance().getButton(InputsEnum.BUTTON_4))
            {
                Vector2 debugDp = new Vector2();

                if (InputSet.getInstance().getLeftDirectionalX() > 0) debugDp.X = 10;
                if (InputSet.getInstance().getLeftDirectionalX() < 0) debugDp.X = -10;
                if (InputSet.getInstance().getLeftDirectionalY() > 0) debugDp.Y = -10;
                if (InputSet.getInstance().getLeftDirectionalY() < 0) debugDp.Y = 10;

                this.getCollider().move(debugDp);
                this.m_attemptedVelocity = Vector2.Zero;

                if (InputSet.getInstance().getButton(InputsEnum.BUTTON_3))
                {
                    Direction d = Direction.Up;
                    bool dirSelected = true;
                    if (InputSet.getInstance().getLeftDirectionalX() > 0) d = Direction.Right;
                    else if (InputSet.getInstance().getLeftDirectionalX() < 0) d = Direction.Left;
                    else if (InputSet.getInstance().getLeftDirectionalY() > 0) d = Direction.Up;
                    else if (InputSet.getInstance().getLeftDirectionalY() < 0) d = Direction.Down;
                    else dirSelected = false;

                    if (dirSelected)
                    {
                        InputSet.getInstance().setToggle(InputsEnum.LEFT_DIRECTIONAL);
                        GameplayManager.DebugZoneTransition(d);
                    }
                }

                return;
            }

            Facing facing = Facing.None;
            if (InputSet.getInstance().getLeftDirectionalX() > 0)
            {
                facing = Facing.Right;
            }
            else if (InputSet.getInstance().getLeftDirectionalX() < 0)
            {
                facing = Facing.Left;
            }
            Facing facingPressed = facing;

            Aiming aiming = Aiming.None;
            bool downPressed = false;
            bool upPressed = false;
            if (InputSet.getInstance().getLeftDirectionalY() > 0)
            {
                aiming = Aiming.Up;
                upPressed = true;
            }
            else if (InputSet.getInstance().getLeftDirectionalY() < 0)
            {
                aiming = Aiming.Down;
                downPressed = true;
            }

            if (InputSet.getInstance().getButton(InputsEnum.LEFT_TRIGGER) &&
                InputSet.getInstance().getButton(InputsEnum.RIGHT_TRIGGER))
            {
                aiming = Aiming.None;
            }
            else if (InputSet.getInstance().getButton(InputsEnum.LEFT_TRIGGER))
            {
                aiming = Aiming.Down;
            }
            else if (InputSet.getInstance().getButton(InputsEnum.RIGHT_TRIGGER))
            {
                aiming = Aiming.Up;
            }

            #endregion

            #region Determine States & Animation

            State nextState = m_previousState;
            Height nextHeight = m_previousHeight;

            switch (m_previousState)
            {
                case State.Idle:
                    if (m_attemptedVelocity.Y < 0 && aiming != Aiming.None)
                    {
                        nextState = State.Airborne;
                    }
                    else if (m_attemptedVelocity.Y < 0)
                    {
                        nextState = State.Takeoff;
                    }
                    else if (IsAirborne)
                    {
                        nextState = State.Airborne;
                    }
                    else if (facing != Facing.None && facing != m_previousFacing)
                    {
                        nextState = State.Turning;
                    }
                    else if (facing != Facing.None && facing == m_previousFacing && nextHeight != Height.Ball)
                    {
                        nextState = State.Moving;
                        nextHeight = Height.Stand;
                    }
                    else if (facing != Facing.None && facing == m_previousFacing && nextHeight == Height.Ball)
                    {
                        nextState = State.Moving;
                        nextHeight = Height.Ball;
                    }
                    else if (m_previousHeight == Height.Stand && downPressed)
                    {
                        nextState = State.Idle;
                        nextHeight = Height.Crouch;
                        InputSet.getInstance().setToggle(InputsEnum.LEFT_DIRECTIONAL);
                    }
                    else if (m_previousHeight == Height.Crouch && upPressed)
                    {
                        nextState = State.Idle;
                        nextHeight = Height.Stand;
                    }
                    else if (m_previousHeight == Height.Crouch && downPressed && Inventory.HasItem(Item.MorphingBall))
                    {
                        nextState = State.Idle;
                        nextHeight = Height.Ball;
                    }
                    else if (m_previousHeight == Height.Ball && upPressed)
                    {
                        nextState = State.Idle;
                        nextHeight = Height.Crouch;
                        InputSet.getInstance().setToggle(InputsEnum.LEFT_DIRECTIONAL);
                    }
                    else
                    {
                        nextState = State.Idle;
                    }
                    break;
                case State.Moving:
                    if (m_attemptedVelocity.Y < 0 && aiming == Aiming.None)
                    {
                        nextState = State.Spin;
                    }
                    else if (m_attemptedVelocity.Y < 0)
                    {
                        nextState = State.Takeoff;
                    }
                    else if (IsAirborne) // fell
                    {
                        nextState = State.Airborne;
                    }
                    else if (facing != Facing.None && facing != m_previousFacing)
                    {
                        nextState = State.Turning;
                    }
                    else if (facing != m_previousFacing)
                    {
                        nextState = State.Idle;
                    }
                    else
                    {
                        nextState = State.Moving;
                    }
                    break;
                case State.Turning:
                    nextState = State.Idle;
                    break;

                case State.Spin:

                    if (aiming != Aiming.None)
                    {
                        m_previousState = State.Airborne; // yes, it's a hack
                    }

                    // yes, this is indeed a goto - it's the C# way of supporting fall through.
                    // because it doesn't support real fall through.
                    // ...even though "break" is required at the end of each case.
                    goto case State.Airborne;

                case State.Airborne:

                    if (!InputSet.getInstance().getButton(InputsEnum.BUTTON_1))
                    {
                        m_attemptedVelocity.Y = Math.Max(0, m_attemptedVelocity.Y);
                    }

                    if (!IsAirborne && aiming == Aiming.None)
                    {
                        nextState = State.Landing;
                    }
                    else if (!IsAirborne)
                    {
                        nextState = State.Idle;
                    }
                    else
                    {
                        nextState = m_previousState; // see Spin hack
                    }
                    break;
                case State.Takeoff:
                    nextState = State.Airborne;
                    break;
                case State.Landing:
                    if (m_previousFacing == facing || facing == Facing.None)
                    {
                        nextState = State.Idle;
                        if (nextHeight != Height.Ball)
                            nextHeight = Height.Stand;
                    }
                    else
                    {
                        nextState = State.Turning;
                    }
                    break;
            }

            if (facing == Facing.None && nextState != State.Turning)
            {
                facing = m_previousFacing;
            }

            bool addHold =
                facingPressed == Facing.None &&
                ((nextState == State.Idle && upPressed) ||
                 (nextState == State.Airborne && (upPressed || downPressed)));

            string animName = String.Format("{0}{1}{2}{3}{4}",
                (nextHeight != Height.Ball) ? nextState.ToString() : "",
                (nextHeight != Height.Ball) ? facing.ToString() : "",
                (nextState != State.Takeoff && nextState != State.Landing
                    && nextState != State.Spin && nextHeight != Height.Ball) ? aiming.ToString() : "",
                addHold ? "Hold" : "",
                (nextState == State.Idle || nextState == State.Turning || nextHeight == Height.Ball) ? nextHeight.ToString() : "" );

            try
            {
                AnimationController.requestAnimation(animName, AnimationController.AnimationCommand.Play);
                //System.Console.WriteLine(animName);
            }
            catch
            {
                System.Console.WriteLine(String.Format("Animation '{0}' not found", animName));
            }

            #endregion

            #region Handle Movement

            if (nextState == State.Moving)
            {
                if (facing == Facing.Left)
                {
                    m_attemptedVelocity.X -= m_speedMax;
                }
                else if (facing == Facing.Right)
                {
                    m_attemptedVelocity.X += m_speedMax;
                }
            }

            if ((nextState == State.Airborne || nextState == State.Spin) &&
                facingPressed != Facing.None)
            {
                if (facing == Facing.Left)
                {
                    m_attemptedVelocity.X -= m_speedMax * 2 / 3;
                }
                else if (facing == Facing.Right)
                {
                    m_attemptedVelocity.X += m_speedMax * 2 / 3;
                }
            }

            #endregion

            #region Handle Shooting
            //Fire a weapon
            if (InputSet.getInstance().getButton(InputsEnum.BUTTON_3)
                && nextState != State.Spin && nextHeight != Height.Ball)
            {
                model.setStat("shots", model.getStat("shots") + 1);

                InputSet.getInstance().setToggle(InputsEnum.BUTTON_3);

                if (this.SelectedWeapon == ProjectileType.Bullet)
                {
                    fire(animName, facing, aiming, ProjectileType.Bullet);
                }
                else if (this.SelectedWeapon == ProjectileType.Missile)
                {
                    fire(animName, facing, aiming, ProjectileType.Missile);
                }
            }

            if (InputSet.getInstance().getButton(InputsEnum.BUTTON_2))
            {
                InputSet.getInstance().setToggle(InputsEnum.BUTTON_2);
                if (this.SelectedWeapon == ProjectileType.Bullet)
                {
                    this.SelectedWeapon = ProjectileType.Missile;
                }
                else if (this.SelectedWeapon == ProjectileType.Missile)
                {
                    this.SelectedWeapon = ProjectileType.Bullet;
                }

            }

            #endregion

            m_previousFacing = facing;
            m_previousAiming = aiming;
            m_previousHeight = nextHeight;
            m_previousState = nextState;

            DoubleRect oldBounds = this.getCollider().Bounds;

            double heightDiff = oldBounds.Height - Math.Min(AnimationController.CurrentSprite.box.Height * AnimationController.Scale - 5, m_baseCollisionBoxHeight);

            DoubleRect newBounds = oldBounds;
            newBounds.Height -= heightDiff;
            newBounds.Y += heightDiff;

            if (this.getCollider().queryDetector(oldBounds).Count < this.getCollider().queryDetector(newBounds).Count)
            {
                newBounds = oldBounds;
            }

            this.getCollider().Bounds = newBounds;
        }
 private void Awake()
 {
     aim            = GetComponentInParent <Aiming>();
     aidImageObject = transform.GetChild(0).gameObject;
 }
Esempio n. 24
0
 void Awake()
 {
     Instance = this;
 }
Esempio n. 25
0
 void Awake()
 {
     //Lifetime = 0;
     aiming = gameObject.GetComponent <Aiming>();
 }
Esempio n. 26
0
 void Awake()
 {
     //实例化自身
     instance = this;
 }
Esempio n. 27
0
 private void Awake()
 {
     cameraController = CameraController.Instance;
     aiming           = GetComponent <Aiming>();
     firePoint        = transform;
 }
Esempio n. 28
0
 void Awake()
 {
     //Lifetime = 0;
     buildManager = BuildManager.singleton;
     aiming       = gameObject.GetComponent <Aiming>();
 }