コード例 #1
0
ファイル: PecsManSystem.cs プロジェクト: Cewein/pecs-man
        private void Create()
        {
            for (int i = 0; i < _number; i++)
            {
                //entity
                GameObject tmp = EntityActionBuffer.Instance.CreateEntity(_prefab);
                tmp.transform.position = GameMananger.RandomNavmeshLocation(40f, tmp);

                //component
                TargetEdible  miam          = new TargetEdible();
                Score         score         = new Score(i, 0, false);
                Vendetta      vendetta      = new Vendetta(false, null);
                TrailRenderer trailRenderer = new TrailRenderer(tmp);
                MeshRenderer  meshRenderer  = new MeshRenderer(tmp);
                NavMeshAgent  navMeshAgent  = new NavMeshAgent(tmp);

                //merging both
                EntityActionBuffer.Instance.AddComponent(tmp, miam);
                EntityActionBuffer.Instance.AddComponent(tmp, score);
                EntityActionBuffer.Instance.AddComponent(tmp, vendetta);
                EntityActionBuffer.Instance.AddComponent(tmp, trailRenderer);
                EntityActionBuffer.Instance.AddComponent(tmp, meshRenderer);
                EntityActionBuffer.Instance.AddComponent(tmp, navMeshAgent);
            }
        }
コード例 #2
0
ファイル: EnemySystem.cs プロジェクト: Cewein/pecs-man
        private void Create()
        {
            for (int i = 0; i < _number; i++)
            {
                //entity
                GameObject tmp = EntityActionBuffer.Instance.CreateEntity(_prefab);
                tmp.transform.position = GameMananger.RandomNavmeshLocation(400, tmp);

                //component
                FollowTarget  follow        = new FollowTarget(null, false);
                TrailRenderer trailRenderer = new TrailRenderer(tmp);
                MeshRenderer  meshRenderer  = new MeshRenderer(tmp);
                NavMeshAgent  navMeshAgent  = new NavMeshAgent(tmp);

                //merging both
                EntityActionBuffer.Instance.AddComponent(tmp, follow);
                EntityActionBuffer.Instance.AddComponent(tmp, trailRenderer);
                EntityActionBuffer.Instance.AddComponent(tmp, meshRenderer);
                EntityActionBuffer.Instance.AddComponent(tmp, navMeshAgent);
            }
        }