示例#1
0
    void Start()
    {
        /*
         * rigidBody = GetComponent<Rigidbody>();
         * startPosition = transform.position;
         * audioSource = GetComponent<AudioSource>();
         * particle = GetComponent<ParticleSystem>();
         * animation = GetComponent<Animation>();
         */

        if (TryGetComponent <Rigidbody>(out var rigidbodyTemp))
        {
            rigidBody = rigidbodyTemp;
        }
        if (TryGetComponent <AudioSource>(out var audioSourceTemp))
        {
            audioSource = audioSourceTemp;
        }
        if (TryGetComponent <ParticleSystem>(out var particleSystemTemp))
        {
            particle = particleSystemTemp;
        }
        if (TryGetComponent <Animation>(out var animationTemp))
        {
            animation = animationTemp;
        }
        startPosition         = transform.position;
        playerContactParticle = FindObjectOfType <PlayerParticle>();
    }
示例#2
0
    void OnSpawn()
    {
        PlayerParticle spawnFX = GameObject.Instantiate(gameManager.SpawnFXPrefab).GetComponent <PlayerParticle>();

        spawnFX.transform.position = playerModel.transform.position;
        spawnFX.SetColor(TeamManager.Instance.GetTeamColor(teamID));
    }
示例#3
0
    void OnDeath(Vector3 force)
    {
        PlayerParticle deathFX = GameObject.Instantiate(gameManager.DeathFXPrefab).GetComponent <PlayerParticle>();

        deathFX.transform.position = playerModel.transform.position;
        deathFX.SetColor(TeamManager.Instance.GetTeamColor(teamID));
        deathFX.SetVector(force);
    }
示例#4
0
文件: Player.cs 项目: WetGrapes/LWD
 void Start()
 {
     BodyPhysic   = gameObject.GetComponent <Rigidbody2D> ();
     Way          = gameObject.GetComponent <Trajectory> ();
     CountManager = Count.GetComponent <Counters> ();
     Particle     = GetComponent <PlayerParticle> ();
     Jumper       = GetComponent <PlayerJumper> ();
     StartCoroutine(Jumper.Play(Grounded, BodyPhysic));
 }
示例#5
0
    protected bool onGround; //是否在地面

    //初始化
    public virtual void OnInit()
    {
        manager  = GetComponent <PlayerStateManager>();
        particle = GetComponent <PlayerParticle>();
        animator = GetComponent <Animator>();
        rigid    = GetComponent <Rigidbody>();
        cc       = GetComponent <CharacterController>();
        player   = GetComponent <PlayerCharacter>();
        camera   = Camera.main.GetComponent <SphereCamera>();
    }
示例#6
0
    void Start()
    {
        manager  = GetComponent <PlayerStateManager>();
        particle = GetComponent <PlayerParticle>();

        //初始化属性值
        hp      = hpMax;
        sp      = spMax;
        ep      = 0;
        epPoint = 3;
        spGain  = 20.0f; //初始状态为 Move 每秒获得耐力值
    }
示例#7
0
    void PlayPlayerContactParticle(Player player, PlayerParticle playerParticle, ContactPoint contactPoint)
    {
        //Debug.Log("playPlayercontactparticle");

        //PlayerParticle playerParticle = FindObjectOfType<PlayerParticle>();

        if (playerParticle != null)
        {
            // _particle.transform.parent = null;
            //_particle.transform.parent = transform;
            playerParticle.transform.position = contactPoint.point;
            playerParticle.PlayParticle();
            player.GetAnimation.Play();
        }
    }
示例#8
0
 public void OnButtonClick()
 {
     ItemBar.NBT nowNBT = ItemBar.nowSelectNbt;
     if (nowNBT.nbtt == ItemBar.NBTType.Effect)
     {
         Effect.AddEffect(ItemBar.nowSelectNbt.effectNBT.et, ItemBar.nowSelectNbt.effectNBT.el);
         PlayerParticle.AddEffect(ItemBar.nowSelectNbt.effectNBT.color);
         ItemBar.nowSelectNbt = new ItemBar.NBT()
         {
             canUse = false
         };
     }
     ItemBar.UseItem();
     bt.enabled      = false;
     btImage.enabled = false;
     btText.enabled  = false;
 }