Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        //ActionType = 1;

        floor   = GameObject.Find("Floor").GetComponent <Floor>();
        pmotion = GetComponent <PlayerMotion>();

        dlg = GameObject.Find("Canvas").GetComponent <ModalDialog>();

        audio_source = gameObject.AddComponent <AudioSource>();
        sounds       = new Dictionary <string, AudioClip>()
        {
            { "walk", audio_walk },
            { "turn", audio_turn },
            { "hit_wall", audio_hit_wall },
        };

        radarLine            = gameObject.AddComponent <LineRenderer>();
        radarLine.material   = new Material(Shader.Find("Particles/Additive"));
        radarLine.startColor = new Color32(12, 220, 12, 128);
        radarLine.endColor   = radarLine.startColor;
        radarLine.startWidth = 0.1f;
        radarLine.endWidth   = 0.1f;

        defaultColor  = GetComponent <Transform>().Find("Body").GetComponent <Renderer>().material.color;
        routeRenderer = gameObject.AddComponent <RouteRenderer>();
    }
Exemplo n.º 2
0
 void Reset()
 {
     dialogues = GetComponentInChildren <TalkativePlayer>();
     sword     = GetComponentInChildren <Sword>();
     motion    = GetComponent <PlayerMotion>();
     dialogues = GetComponent <TalkativePlayer>();
 }
Exemplo n.º 3
0
	void Update()
	{
		GameObject timeRef = this.gameObject;
		//		GameObject timeRef = GameObject.Find("Character_2_withTime");
		timeRefScript = (PlayerMotion) timeRef.GetComponent(typeof(PlayerMotion));
		if(!timeRefScript.getIsDone() && !timeRefScript.getIsPaused()) {
			milliseconds += Time.deltaTime;
			if (milliseconds > 1)
			{
				seconds++;
				milliseconds = 0;
			}
			if (seconds > 60)
			{
				minutes++;
				seconds = 0;
			}
		}

		if (PlayerPrefs.GetInt("InvertX") == 0) {
			invertXButtonString = "button2";
		} else {
			invertXButtonString = "button5";
		}
		
		if (PlayerPrefs.GetInt("InvertY") == 0) {
			invertYButtonString = "button2";
		} else {
			invertYButtonString = "button5";
		}
	}
Exemplo n.º 4
0
 public override void UpdateLogic()
 {
     mNext = STATUS.NONE;
     if (shouldMove)
     {
         PlayerMotion playerMotion = CharacterManager.playerCS.pm;
         if (playerMotion.cs == null || playerMotion.cs.attackTarget == null || playerMotion.cs.isDie || playerMotion.cs.attackTarget.isDie)
         {
             return;
         }
         Vector3 relativePos  = playerMotion.cs.attackTarget.transform.position - playerMotion.cs.transform.position;
         float   tempDistance = Vector3.Distance(playerMotion.cs.transform.position, playerMotion.cs.attackTarget.transform.position);
         if (playerMotion.cs.mCurSkillNode != null)
         {
             if (tempDistance <= playerMotion.cs.mCurSkillNode.dist)
             {
                 ReleaseSkill();
             }
             else
             {
                 mController.SetDirection(relativePos);
                 mController.Move(relativePos);
             }
         }
     }
     else
     {
         mController.SetDirection(TouchHandler.GetInstance().mOffset);
         mController.Move(TouchHandler.GetInstance().mOffset);
     }
 }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     player = transform.root.gameObject.GetComponent <PlayerMotion>();
     x      = player.PowerLevel * 3f / 5f;
     y      = player.PowerLevel * 3f / 5f;
     z      = player.PowerLevel * 3f / 5f;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 立つ状態の判断
 /// </summary>
 private void Stand()
 {
     if (diretion == Direction.UP || diretion == Direction.DOWN)//葉梨竜太 Down追加// && !IsThrowing())
     {
         animePlayer.PlayAnimation(standAnime);
         playerMotion = PlayerMotion.STAND;
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 横向きの状態の判断
 /// </summary>
 private void StandSideWays()
 {
     if ((diretion == Direction.LEFT || diretion == Direction.RIGHT))// && !IsThrowing())
     {
         animePlayer.PlayAnimation(sidewaysAnime);
         playerMotion = PlayerMotion.SIDEWAYS;
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 走る状態の判断
 /// </summary>
 private void Run()
 {
     if (diretion == Direction.LEFT || diretion == Direction.RIGHT)// && !IsThrowing())
     {
         animePlayer.PlayAnimation(runAnime);
         playerMotion = PlayerMotion.RUN;
     }
 }
Exemplo n.º 9
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        PlayerMotion pm = animator.GetComponent <PlayerMotion>();

        pm.canAttackSwitch++;
        pm.canSkillSwitch++;
        pm.canMoveSwitch++;
    }
Exemplo n.º 10
0
 /// <summary>
 /// 立つ状態の判断(弱い火)
 /// </summary>
 private void LowStand()
 {
     if (diretion == Direction.UP || diretion == Direction.DOWN) //葉梨竜太 Down追加
     {
         animePlayer.PlayAnimation(lowStandAnime);
         playerMotion = PlayerMotion.LOWSTAND;
     }
 }
Exemplo n.º 11
0
 private void Start()
 {
     //初期ダメージ
     inv_time    = InvincibleTime;
     Player      = GameObject.FindWithTag("Player");
     PM          = Player.GetComponent <PlayerMotion>();
     audioSource = gameObject.AddComponent <AudioSource>();
 }
Exemplo n.º 12
0
 /// <summary>
 /// 横向きの状態の判断(弱い火)
 /// </summary>
 private void LowStandSideWays()
 {
     if ((diretion == Direction.LEFT || diretion == Direction.RIGHT))
     {
         //仮実装by長谷川
         animePlayer.PlayAnimation(lowSidewaysAnime);
         playerMotion = PlayerMotion.SIDEWAYS;
     }
 }
Exemplo n.º 13
0
    // when player touches spike,
    // they should die and go back to last checkpoint
    // the same as if they touched an enemy.

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.GetComponent <PlayerMotion>())
        {
            PlayerMotion player = collision.GetComponent <PlayerMotion>();
            player.PlayerPerish();
            Debug.Log("oof");
        }
    }
Exemplo n.º 14
0
    public void OnJump()
    {
        var move_x = Input.GetAxis("Horizontal");

        JumpHoldTime = Time.time;
        PlayerMotion.ApplyImpulse(new Vector3(HorizontalJumpSpeed * move_x, JumpSpeed, 0.0f));
        SetCollidersEnabled(false);
        AirColliders.gameObject.SetActive(true);
        Animator.ResetTrigger("Jump");
    }
Exemplo n.º 15
0
 void Awake()
 {
     pm = GetComponent <PlayerMotion>();
     cs = GetComponent <CharacterState>();
     PlayerEffect();
     if (cs.mCurMobalId == MobaObjectID.HeroJiansheng)
     {
         Invoke("DestoryMe", 2.7f);
     }
 }
Exemplo n.º 16
0
 //new Size(50,52)の中身を(64,64)に修正
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="input"></param>
 /// <param name="position">位置</param>
 /// <param name="velocity">移動量</param>
 /// <param name="fires">投げ出した火のList、書き出す</param>
 public Player(GameDevice gameDevice, Vector2 position, Vector2 velocity, ref List <Fire> firesList, ref List <WaterLine> watersList, bool isView)
     : base("hero", position, velocity, true, "Player")
 {
     this.gameDevice = gameDevice;
     inputState      = gameDevice.GetInputState();
     sound           = gameDevice.GetSound();
     this.firesList  = firesList;
     this.watersList = watersList;
     this.isView     = isView;
     playerMotion    = PlayerMotion.STAND;
 }
Exemplo n.º 17
0
    //コンポーネントの取得
    void LoadComponents()
    {
        //タイトル画面じゃないなら取得
        if (SceneManager.GetActiveScene().name == "MainScene")
        {
            playermotion    = GameObject.Find("Player").GetComponent <PlayerMotion>();
            playerRigidbody = GameObject.Find("Player").GetComponent <Rigidbody>();

            game_stop_flg = true;
            pause_flg     = false;
        }
    }
Exemplo n.º 18
0
 private void SetCsAndPm(Animator animator)
 {
     if (cs == null)
     {
         cs = animator.GetComponent <CharacterState>();
     }
     if (pm == null)
     {
         pm = animator.GetComponent <PlayerMotion>();
     }
     mTouchHandler = TouchHandler.GetInstance();
     mFightTouch   = FightTouch._instance;
 }
Exemplo n.º 19
0
    // Start is called before the first frame update
    void Start()
    {
        player   = GameObject.Find("Sorceress");
        player_c = player.GetComponent <PlayerControl>();
        player_m = player.GetComponent <PlayerMotion>();
        cam      = GameObject.Find("Main Camera");

        TrapOn = false;

        init_diablo  = 10000;
        init_Izual   = 2000;
        init_Hepasto = 2000;
    }
Exemplo n.º 20
0
    /******************************************************
    * public method for disabling acceleration/reverse
    ******************************************************/

    public void applyIdleMotion()
    {
        if (currentMotion == PlayerMotion.Idle)
        {
            return;
        }

        for (int i = 0; i < motionListeners.Count; i++)
        {
            motionListeners[i].OnIdle();
        }

        currentMotion = PlayerMotion.Idle;
    }
Exemplo n.º 21
0
    /******************************************************
    * public method for enabling reverse motion
    ******************************************************/

    public void applyReverse()
    {
        if (currentMotion == PlayerMotion.Reverse)
        {
            return;
        }

        for (int i = 0; i < motionListeners.Count; i++)
        {
            motionListeners[i].OnReverse();
        }

        currentMotion = PlayerMotion.Reverse;
    }
Exemplo n.º 22
0
    // リザルト処理
    IEnumerator Result()
    {
        yield return(new WaitForEndOfFrame());

        //プレイヤーを停止させる
        gameManager.game_stop_flg = true;
        gameManager.pause_flg     = false;

        yield return(new WaitForSeconds(1.0f));

        score = PlayerMotion.GetScore();
        audioSource.PlayOneShot(score_se);
        ScoreText.text = score.ToString();

        yield return(new WaitForSeconds(1.0f));

        countdown = TimeManager.GetTime();
        minites   = Mathf.FloorToInt(countdown / 60F);
        seconds   = Mathf.FloorToInt(countdown - minites * 60);
        mseconds  = Mathf.FloorToInt((countdown - minites * 60 - seconds) * 100);
        audioSource.PlayOneShot(score_se);
        if (countdown == 0f)
        {
            timeText.text = "Over";
        }
        else
        {
            timeText.text = string.Format("{0:00}:{1:00}:{2:00}", minites, seconds, mseconds);
        }
        bonus          = Mathf.FloorToInt(countdown * 10);
        BonusText.text = "+" + bonus.ToString();

        yield return(new WaitForSeconds(1.5f));

        total          = score + bonus;
        TotalText.text = total.ToString();
        audioSource.PlayOneShot(total_se);

        yield return(new WaitForSeconds(1.5f));

        // ランキング表示
        naichilab.RankingLoader.Instance.SendScoreAndShowRanking(total);

        yield return(new WaitUntil(() => naichilab.RankingSceneManager.GetRanking() == true));

        gameManager.GameOver();
    }
Exemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        //base
        floor   = GameObject.Find("Floor").GetComponent <Floor> ();
        pmotion = GetComponent <PlayerMotion> ();

        //modal
        dlg = GameObject.Find("Canvas").GetComponent <ModalDialog> ();

        //audio
        audio_source = gameObject.AddComponent <AudioSource>();
        sounds       = new Dictionary <string, AudioClip>()
        {
            { "walk", audio_walk },
            { "turn", audio_turn },
            { "hit_wall", audio_hit_wall },
        };
    }
Exemplo n.º 24
0
    IEnumerator ChangePlayerColor()
    {
        PlayerMotion   Player_m = Player.GetComponent <PlayerMotion>();
        SpriteRenderer Img      = Player.GetComponent <SpriteRenderer>();

        Player_m.walk_speed = 0.5f;
        Player_m.run_speed  = 1.0f;
        Player.GetComponent <Animator>().SetFloat("walkSpeed", 0.3f);
        Player.GetComponent <Animator>().SetFloat("runSpeed", 0.3f);
        Img.color = new Color(0, 0, 255);
        yield return(new WaitForSeconds(6f));

        Player_m.walk_speed = 1.5f;
        Player_m.run_speed  = 1.7f;
        Player.GetComponent <Animator>().SetFloat("walkSpeed", 1.2f);
        Player.GetComponent <Animator>().SetFloat("runSpeed", 1.2f);
        Img.color = new Color(255, 255, 255);
    }
Exemplo n.º 25
0
    /******************************************************
    * public method for enabling acceleration
    ******************************************************/

    public void applyAcceleration()
    {
        if (!enabled)
        {
            return;
        }

        if (currentMotion == PlayerMotion.Accel)
        {
            return;
        }

        for (int i = 0; i < motionListeners.Count; i++)
        {
            motionListeners[i].OnAccelrate();
        }

        currentMotion = PlayerMotion.Accel;
    }
Exemplo n.º 26
0
    // Use this for initialization prior to anything else happening
    void Awake()
    {
        playermotion = transform.GetComponent <PlayerMotion>();

        m_childStates = new List <StateNode>();

        //we must always add at least one, if we want the graph to run
        IdleState idlestate = new IdleState(this);

        m_childStates.Add(idlestate);

        //order matters!!!
        JumpState jumpstate = new JumpState(this);

        idlestate.addChildState(jumpstate);

        WalkState walkstate = new WalkState(this);

        idlestate.addChildState(walkstate);
    }
Exemplo n.º 27
0
    void Awake()
    {
        //Destroy( GetComponent<CharacterController>() );
        //Destroy( GetComponent<CharacterState>() );
        //if ( GetComponent<Monster_AI>() != null)
        //{
        //    GetComponent<Monster_AI>().enabled = false;
        //}

        //cameraAngle = Camera.main.transform.rotation.eulerAngles;
        playerMotion = GetComponent <PlayerMotion>();
        if (GetComponent <UnityEngine.AI.NavMeshAgent>() == null)
        {
            gameObject.AddComponent <UnityEngine.AI.NavMeshAgent>();
        }
        navMA         = GetComponent <UnityEngine.AI.NavMeshAgent>();
        navMA.enabled = false;
        rType         = RoleType.monster;
        PlayPrepare();
    }
Exemplo n.º 28
0
    List <int> GetDistances(List <Directions> availableDirs, GameObject target)
    {
        List <int> rList = new List <int>();

        int len = availableDirs.Count;

        int[] targetPosition;

        PlayerMotion targetMotion = target.GetComponent <PlayerMotion>();

        if (type == EnemyType.Aggressive || targetMotion.GetMoveDirection() == Directions.None)
        {
            targetPosition = MapUtility.TranslateWorldToMapCoordinates(target);
        }
        else
        {
            targetPosition = MapUtility.FindNextJunction(targetMotion.GetPosition(), targetMotion.GetCurrentDirection());
        }

        int[] currentPosition = MapUtility.TranslateWorldToMapCoordinates(transform.gameObject);

        int[] junction = new int[2];

        Vector3 junction1 = new Vector3();

        for (int i = 0; i < len; i++)
        {
            try {
                junction = MapUtility.FindNextJunction(currentPosition, availableDirs[i]);
            } catch (Exception e) {
                e.GetType();
                junction1 = MapUtility.GetDeadEndPosition(MapUtility.TranslateWorldToMapCoordinates(transform.gameObject), transform.gameObject, availableDirs[i]);

                junction = MapUtility.TranslateWorldToMapCoordinates(junction1);
            }

            rList.Add(MapUtility.GetDistance(targetPosition, junction));
        }

        return(rList);
    }
Exemplo n.º 29
0
    private void RotatePlayer()
    {
        if (CharacterManager.playerCS == null || CharacterManager.playerCS.isDie)
        {
            return;
        }
        PlayerMotion pm = CharacterManager.playerCS.pm;

        if (!pm.CanMoveState())
        {
            return;
        }

        //向量v围绕y轴旋转cameraAngle.y度
        Vector3    q           = Quaternion.Euler(0, 0, 0) * v;
        Quaternion qq          = Quaternion.LookRotation(q);
        Transform  playerTrans = CharacterManager.player.transform;

        playerTrans.rotation = Quaternion.Lerp(playerTrans.rotation, qq, Time.deltaTime * 100);
        ClientSendDataMgr.GetSingle().GetWalkSend().SendSelfPos();
    }
Exemplo n.º 30
0
        /// <summary>
        /// 初期化メソッド
        /// </summary>
        public override void Initialize()
        {
            base.Initialize();
            map    = MapManager.GetNowMapData();
            gForce = Parameter.GForce;

            diretion         = Direction.RIGHT;
            firstFireNum     = Parameter.FirstFireNum;
            fireNum          = firstFireNum;
            runAnime         = new Animation(Renderer.GetTexture("playerAnime"), 0.1f, true);
            standAnime       = new Animation(Renderer.GetTexture("standAnime"), 0.1f, true);
            sidewaysAnime    = new Animation(Renderer.GetTexture("sideAnime"), 0.1f, true);
            throwAnime       = new Animation(Renderer.GetTexture("throwAnime"), 0.1f, false);
            deathAnime       = new Animation(Renderer.GetTexture("deathAnime"), 0.1f, false);
            lowRunAnime      = new Animation(Renderer.GetTexture("lowRunAnime"), 0.1f, true);
            lowSidewaysAnime = new Animation(Renderer.GetTexture("lowSideAnime"), 0.1f, true);
            lowStandAnime    = new Animation(Renderer.GetTexture("lowStandAnime"), 0.1f, true);
            lowDeathAnime    = new Animation(Renderer.GetTexture("lowDeathAnime"), 0.1f, false);

            isClear      = false;
            isOnBalloon  = false;
            playerMotion = PlayerMotion.STAND;
            animePlayer.PlayAnimation(standAnime);

            jumpEffectTimer             = new Timer(0.15f);
            jumpEffectTimer.CurrentTime = 0;
            fallEffectTimer             = new Timer(0.15f);
            fallEffectTimer.CurrentTime = 0;
            aim       = new Vector2(Parameter.FireSpeed, 0);
            armsUpPos = new Vector2(560, 210);
            //FireDust
            fireDustList      = new List <FireDust>();
            makeFireDustTimer = new Timer(0.1f);

            //FireEnergy
            fireEnergy = new FireEnergy(position, 50);

            isthrow = true;
        }
Exemplo n.º 31
0
    void Awake()
    {
        cs = GetComponent <CharacterState>();
        pm = GetComponent <PlayerMotion>();

        foreach (Transform item in transform)
        {
            if (item.name == "Purse")
            {
                purse.Add(item.gameObject);
            }
        }

        index = purse.Count;

        foreach (Transform item in transform.parent)
        {
            if (item.gameObject.tag == Tag.auto)
            {
                autoPoints.Add(item.gameObject);
            }
        }
    }