Пример #1
0
 void Awake()
 {
     tiles     = FindObjectsOfType <Tile>().ToList();
     graph     = GetComponent <Graph>();
     graphView = GetComponent <GraphView>();
     player    = FindObjectOfType <PlayerMover>();
 }
Пример #2
0
        private void Start()
        {
            _player = FindObjectOfType <PlayerMover>();
            if (_player == null)
            {
                Debug.Log(_ERR_NOT_EXIST_PLAYER);
            }
            _maxMovePointsWay = _player.MaxCountMovePoint;
            _lastPoint        = _player.Transform.position;

            _camera = Camera.main;

            var colorKeys = new GradientColorKey[_COUNT_COLOR_KEYS];

            colorKeys[0].color = Color.blue;
            colorKeys[0].time  = _GRADIENT_MIN;
            colorKeys[1].color = new Color(0.3f, 0.7f, 0.5f);
            colorKeys[1].time  = _GRADIENT_MAX;

            var gradient = new Gradient();

            gradient.colorKeys = colorKeys;
            gradient.mode      = GradientMode.Fixed;

            var temp = new GameObject("LineRender");

            _lineRender               = temp.AddComponent <LineRenderer>();
            _lineRender.material      = MaterialLine;
            _lineRender.colorGradient = gradient;
            _lineRender.startWidth    = _LINE_RENDER_WIDTHS;
            _lineRender.endWidth      = _LINE_RENDER_WIDTHS;
            _lineRender.positionCount = _LINE_RENDER_NUMER_SIGMENTS;
        }
        public void BeforeEach()
        {
            var go = new GameObject();

            _mover = go.AddComponent <PlayerMover>();
            _mover.moveQueue.Add(new GameObject().transform);
        }
Пример #4
0
        private bool checkClimbingUp(PlayerMover playerMover)
        {
            float distToBottom = Vector3.Distance(playerMover.transform.position, mountPositionBottom);
            float distToTop    = Vector3.Distance(playerMover.transform.position, mountPositionTop);

            return(distToBottom < distToTop);
        }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        if (!playerMover)
        {
            GameObject go = null;
            if (top)
            {
                go = GameObject.Find("PlayerTop");
            }
            else
            {
                go = GameObject.Find("PlayerBot");
            }
            if (go != null)
            {
                playerMover = go.GetComponent <PlayerMover> ();
            }
        }

        if (playerMover)
        {
            if (playerMover.runAnim.activeInHierarchy && playerMover.onGround)
            {
                footstepsSource.mute = false;
            }
            else
            {
                footstepsSource.mute = true;
            }
        }
    }
Пример #6
0
    // Update is called once per frame
    void FixedUpdate()
    {
        float diff = Time.time - (birth + windup);

        transform.Rotate(new Vector3(0, 0, 150f * Time.fixedDeltaTime));
        if (diff > 0)
        {
            column.gameObject.SetActive(true);
            if (isServer)
            {
                Collider[] found = Physics.OverlapCapsule(transform.position, transform.position + Vector3.up * col.height, col.radius * transform.localScale.x, 1 << 10);
                foreach (Collider other in found)
                {
                    PlayerMover pm = other.GetComponent <PlayerMover>();
                    if (pm.team != ownerTeam && !hit.Contains(other.gameObject))
                    {
                        hit.Add(other.gameObject);
                        Vector3 hitDirection = other.gameObject.transform.position - transform.position;

                        hitDirection.Normalize();
                        hitDirection.y = 5;
                        hitDirection.Normalize();
                        other.GetComponent <PlayerMover>().getHit(forceVertical, hitDirection, 1, ownerTeam);
                    }
                }
            }
        }
    }
Пример #7
0
    // ═══╣ methods ╠═══
    void Awake()
    {
        m_player = Object.FindObjectOfType <PlayerMover> ();
        FillNodeList();

        m_goalNode = FindGoalNode();
    }
Пример #8
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            throw new System.Exception();
        }
        this.PlayerTransform = this.transform;

        this.playerMover      = GetComponent <PlayerMover>();
        this.playerMouseMover = GetComponent <PlayerMouseMover>();

        if (StageStaticData.inputPlayerMovementByKeybord)
        {
            this.playerMouseMover.enabled = false;
            this.playerMover.enabled      = true;
        }
        else
        {
            this.playerMover.enabled        = false;
            this.playerMouseMover.enabled   = true;
            GetComponent <Rigidbody>().mass = 100000f;
        }
    }
        private void ChangePath2(SwipeInput.SwipeType swipeType)
        {
            var targetLine = currentRoadId;

            switch (swipeType)
            {
            case SwipeInput.SwipeType.Left:
                targetLine = Mathf.Clamp(--targetLine, 0, levelHolder._lines.Length - 1);
                break;

            case SwipeInput.SwipeType.Right:
                targetLine = Mathf.Clamp(++targetLine, 0, levelHolder._lines.Length - 1);
                break;
            }
            if (targetLine == currentRoadId)
            {
                return;
            }
            var p0 = _follower.result;                                                                                         // point on current spline
            var p1 = levelHolder._lines[targetLine].Evaluate(levelHolder._lines[targetLine].Project(p0.position));             // closest point on side line
            var d  = p0.position - p1.position;

            if (!PlayerMover.CheckLineSwap(levelHolder._lines[targetLine], p0, levelHolder._lineWidth))
            {
                return;
            }
            OnTrackChange?.Invoke(currentRoadId, targetLine);
            currentRoadId = targetLine;
            d.Normalize();
            var d2 = new Vector2(Vector3.Dot(d, p1.right), Vector3.Dot(d, p1.normal));             // offset is [X * point.right + Y * point.normal]

            _follower.computer   = levelHolder._lines[currentRoadId];
            _changeRoadCoroutine = StartCoroutine(SwitchLine(d2));
        }
Пример #10
0
    // Use this for initialization
    void Start()
    {
        spotlight         = GetComponent <Light> ();
        spotlight.enabled = false;

        player      = GameObject.FindGameObjectWithTag("Player");
        playerMover = player.GetComponent <PlayerMover> ();
    }
Пример #11
0
    void Start()
    {
        player = FindObjectOfType <PlayerMover>();
        game   = FindObjectOfType <GameManager>();
        wave   = FindObjectOfType <WaveDefiner>();

        extra = false;
    }
Пример #12
0
    // Use this for initialization
    void Start()
    {
        animators = GetComponentsInChildren <Animator> ();

        spriteRender = GetComponentsInChildren <SpriteRenderer> ();

        playerMove = GetComponent <PlayerMover> ();
    }
Пример #13
0
        public void Initialize(PlayerModel playerModel, IInput input, IStage stage)
        {
            player   = playerModel;
            mover    = new PlayerMover(player, input);
            attacker = new Attacker(player, input);

            player.Position.Subscribe(playerView.SetPosition).AddTo(this);
        }
Пример #14
0
 // Start is called before the first frame update
 void Start()
 {
     referenceManager = GameObject.Find("Managers").GetComponent <ReferenceManager>();
     player           = referenceManager.player.GetComponent <PlayerMover>();
     npcCanvas        = referenceManager.npcInteractedCanvas;
     gasValve         = LayerMask.GetMask("GasValve");
     waterHeater      = LayerMask.GetMask("WaterHeater");
 }
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     playerHealth = player.GetComponent<PlayerHealth> ();
     playerMover = player.GetComponent<PlayerMover> ();
     squigee = this.transform.parent.gameObject;
     squigeeHealth = squigee.GetComponent<SquigeeHealth>();
 }
    private void Start()
    {
        GameObject  playerPrefab         = GameObject.FindWithTag("Player");
        PlayerMover playerMovementScript = playerPrefab.GetComponent <PlayerMover>();

        playerSpeed    = playerMovementScript.speed;
        playerWalkAnim = GetComponent <Animator>();
    }
 void Awake()
 {
     player        = GameObject.FindGameObjectWithTag("Player");
     playerHealth  = player.GetComponent <PlayerHealth> ();
     playerMover   = player.GetComponent <PlayerMover> ();
     squigee       = this.transform.parent.gameObject;
     squigeeHealth = squigee.GetComponent <SquigeeHealth>();
 }
Пример #18
0
 private void Awake()
 {
     mover         = GetComponent <PlayerMover>();
     fighter       = GetComponent <PlayerFighter>();
     thrower       = GetComponent <PlayerThrower>();
     weaponHandler = GetComponentInChildren <WeaponHandler>();
     stashSystem   = FindObjectOfType <WeaponStashSystem>();
 }
Пример #19
0
 private void Awake()
 {
     scoreCounter = GetComponent <ScoreCounter>();
     _mover       = GetComponent <PlayerMover>();
     _life        = GetComponent <PlayerLife>();
     _skin        = GetComponent <PlayerSkins>();
     UsedBooster += OnBoosterUsed;
 }
Пример #20
0
    private void Start()
    {
        mover = GetComponent <PlayerMover>();
        var gameController = GameObject.FindWithTag("GameController");

        inventory = gameController.GetComponentInChildren <InventoryManager>();
        stamina   = gameController.GetComponentInChildren <StaminaManager>();
    }
Пример #21
0
 protected override void Awake()
 {
     base.Awake();
     playerMover = GetComponent <PlayerMover>();
     playerInput = GetComponent <PlayerInput>();
     m_board     = Object.FindObjectOfType <Board>().GetComponent <Board>();
     playerInput.InputEnabled = true;
 }
Пример #22
0
 public static void SetPlayer(GameObject go, PlayerPropertiesSave playerSave)
 {
     GO          = go;
     Properties  = new PlayerProperties(playerSave);
     playerMover = new PlayerMover();
     playerMover.ListenToInput();
     playerRotator = new PlayerRotator();
 }
Пример #23
0
 private void Awake()
 {
     MakeSingleton();
     playerMover = GetComponent <PlayerMover>();
     playerInput = GetComponent <PlayerInput>();
     finder      = GetComponent <BoxCollider2D>();
     swapBtn     = Object.FindObjectOfType <MovePosition>().GetComponent <MovePosition>();
 }
 public ParallelMovingCheck(Transform mover, PlayerMover playerMover)
 {
     _mover                           = mover;
     _playerMover                     = playerMover;
     _enemyMask                       = LayerMask.GetMask("Enemy");
     PlayerMover.OnArrival           += ClearInvalidUnits;
     PlayerMover.RequestedNewPackage += ClearInvalidUnits;
 }
Пример #25
0
    private void Awake()
    {
        playerInput = GetComponent <PlayerInput>();
        var movers = FindObjectsOfType <PlayerMover>();
        var index  = playerInput.playerIndex;

        mover = movers.FirstOrDefault(m => m.GetPlayerIndex() == index);
    }
Пример #26
0
 void Awake()
 {
     instance = this;
     if (spawnPoint != null)
     {
         SetTargetPosition(spawnPoint.transform.position, spawnPoint, true);
     }
 }
 public AnimatorCommunicator(Rigidbody2D rb2d, Animator animator, CollisionChecker collisionChecker, PlayerMover playerMover, Attacker attacker)
 {
     _rb2d             = rb2d;
     _animator         = animator;
     _attacker         = attacker;
     _playerMover      = playerMover;
     _collisionChecker = collisionChecker;
 }
 private void Awake()
 {
     _attacker             = new Attacker(1f);
     _jumpModifier         = new JumpModifier(rb2d, 2f, 2.5f);
     _collisionChecker     = new CollisionChecker(wallCheckPoints, groundCheckPoint);
     _playerMover          = new PlayerMover(rb2d, moveSpeed, transform, jumpPower, _collisionChecker);
     _animatorCommunicator = new AnimatorCommunicator(rb2d, animator, _collisionChecker, _playerMover, _attacker);
 }
    // Use this for initialization
    void Start()
    {
        spotlight = GetComponent<Light> ();
        spotlight.enabled = false;

        player = GameObject.FindGameObjectWithTag ("Player");
        playerMover = player.GetComponent<PlayerMover> ();
    }
Пример #30
0
        public virtual void HandleEffect(PlayerMover player)
        {
            player.Score += scoreValue;

            //TODO pool
            SpawnerManager.Despawn(this);
            Destroy(gameObject);
        }
Пример #31
0
 // Use this for initialization
 new void Awake()
 {
     base.Awake();
     currentShield = maxShield;
     //pm = (PlayerMover)mover;
     pm             = (PlayerMover)mover;
     currentSegment = 1;
 }
Пример #32
0
        /// <summary>
        /// Moves to somewhere.
        /// </summary>
        /// <param name="location">where to move to</param>
        /// <param name="destinationName">name of location for debugging purposes</param>
        /// <param name="range">how close it should get</param>
        public static async Task <bool> Execute(Vector3 location, string destinationName = "", float range = 10f, Func <bool> stopCondition = null)
        {
            if (string.IsNullOrEmpty(destinationName))
            {
                destinationName = location.ToString();
            }

            _startingWorldId = ZetaDia.Globals.WorldSnoId;

            if (Core.Player.IsInTown)
            {
                GameUI.CloseVendorWindow();
            }

            while (ZetaDia.Me.LoopingAnimationEndTime > 0)
            {
                await Coroutine.Sleep(50);
            }

            Navigator.PlayerMover.MoveTowards(location);

            while (ZetaDia.IsInGame && location.Distance2D(ZetaDia.Me.Position) >= range && !ZetaDia.Me.IsDead)
            {
                if (Navigator.StuckHandler.IsStuck)
                {
                    await Navigator.StuckHandler.DoUnstick();

                    Core.Logger.Verbose("MoveTo Finished. (Stuck)", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    break;
                }

                if (stopCondition != null && stopCondition())
                {
                    Core.Logger.Verbose("MoveTo Finished. (Stop Condition)", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    return(false);
                }

                if (_startingWorldId != ZetaDia.Globals.WorldSnoId)
                {
                    Core.Logger.Verbose("MoveTo Finished. World Changed from {0} to {1}", _startingWorldId, ZetaDia.Globals.WorldSnoId);
                    return(false);
                }

                Core.Logger.Verbose("Moving to " + destinationName);
                PlayerMover.MoveTo(location);
                await Coroutine.Yield();
            }

            var distance = location.Distance(ZetaDia.Me.Position);

            if (distance <= range)
            {
                Navigator.PlayerMover.MoveStop();
            }

            Core.Logger.Verbose("MoveTo Finished. Distance={0}", distance);
            return(true);
        }
 void Awake()
 {
     GameObject p = GameObject.FindGameObjectWithTag("Player");
     player = p.transform;
     playerMover = p.GetComponent<PlayerMover>();
     animator = GetComponent<Animator>();
     nav = GetComponent<NavMeshAgent>();
     squigeeHealth = GetComponent<SquigeeHealth>();
 }
 void Awake()
 {
     animator = GetComponent<Animator> ();
     playerMover = GetComponent<PlayerMover>();
 }
Пример #35
0
 void Awake()
 {
     instance = this;
     if(spawnPoint != null){
         SetTargetPosition(spawnPoint.transform.position,spawnPoint, true);
     }
 }
Пример #36
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag ("Player");

        partSys = gameObject.GetComponent<ParticleSystem> ();
        playerMover = player.GetComponent<PlayerMover> ();
        sound = GetComponent<AudioSource> ();

        jetPackLight = GetComponent<Light> ();
        jetPackLight.enabled = false;

        partSys.enableEmission = false;
        partSys.Play ();

        speedRange = maxSpeed - minSpeed;
        sizeRange = maxSize - minSize;

        rotation.Set (90f, 0f, 0f);
        transform.localEulerAngles = rotation;

        toRotation = Quaternion.LookRotation (new Vector3 (0f, -100f, 0f));
    }
Пример #37
0
	// Use this for initialization
	void Start () {
		player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerMover>();
		env = GameObject.FindGameObjectWithTag ("Background").GetComponent<EnvironmentInit> ();

		Cursor.visible = true;
	}