예제 #1
0
 public static LongNoteBasis GetInstance()
 {
     if (Instance == null)
     {
         Instance = new LongNoteBasis();
     }
     return(Instance);
 }
예제 #2
0
            public void Execute(ref Position position, ref LongNoteComponent longNote)
            {
                //LongNoteBasis.Instance.GetStopPos(LaneController.NoteNum - 1)
                Vector3 pos = new Vector3(-1.65f, -0.2f, -10);
                //if (LaneController.InLongNote)
                //{
                float3 forceDir = LongNoteBasis.GetInstance().GetStopPos(LaneController.NoteNum - 1) - longNote.position;

                forceDir          = math.normalize(forceDir) * 1f;
                longNote.Velocity = forceDir;

                //longNote.position += longNote.Velocity * LongNoteBasis.Instance.moveSpeed;

                position.Value = longNote.position;
                //}
            }
예제 #3
0
            public void Execute(Entity entity, int index, ref LongNoteComponent longNote, ref Scale scale)
            {
                if (longNote.position.z <= LongNoteBasis.GetInstance().GetHitPos(LaneController.NoteNum - 1).z + 1.0f &&
                    longNote.position.z >= LongNoteBasis.GetInstance().GetHitPos(LaneController.NoteNum - 1).z - 1.0f &&
                    LaneController.HitOrNot)
                {
                    entityCommandBuffer.DestroyEntity(index, entity);
                }


                longNote.lifeTime = longNote.lifeTime - deltaTime;

                if (longNote.lifeTime <= 0)
                {
                    entityCommandBuffer.DestroyEntity(index, entity);
                }
            }
예제 #4
0
        /// <summary>
        /// 生成长音符
        /// </summary>
        public void GenerateLongNote()
        {
            if (LaneController.InLongNote)
            {
                var entityManager = World.Active.GetOrCreateManager <EntityManager>();

                for (int i = 0; i < LongNoteBasis.GetInstance().createNum_perMS; i++)
                {
                    Entity longNote = entityManager.CreateEntity(LongNoteArchetype);

                    float3 randomVel = UnityEngine.Random.onUnitSphere;
                    //float3 randomVel = UnityEngine.Random.value;
                    float3 longNotePos     = LongNoteBasis.GetInstance().GetCreatePos(LaneController.NoteNum - 1);
                    float3 initialPosition = new float3(longNotePos.x + randomVel.x, longNotePos.y + randomVel.y, longNotePos.z - 12f);

                    entityManager.SetComponentData(longNote, new Position {
                        Value = initialPosition
                    });
                    //entityManager.SetComponentData(cube, new Rotation { Value = Quaternion.Euler(90, 0, 0) });
                    entityManager.SetComponentData(longNote, new Scale {
                        Value = new float3(0.25f, 0.25f, 0.25f)
                    });

                    LongNoteComponent l = new LongNoteComponent
                    {
                        position = initialPosition,
                        lifeTime = LongNoteBasis.GetInstance().lifeTime,

                        Velocity = new float3(0, 0, -1f),
                    };

                    entityManager.SetComponentData(longNote, l);

                    entityManager.SetSharedComponentData(longNote, longNoteRenderer);
                }
            }
        }
예제 #5
0
 void Awake()
 {
     Instance = this;
 }