Activation
How do I use Activation
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: Enemy.cs
Copy
66 public void Activation(Vector3 revealPosition, Vector3 _moveDirection)
67 {
68 transform.position = revealPosition;
69
70 if (enemyType == 2)
71 {
72 moveDirection = _moveDirection;
73 movingSpeed = 2;
74 }
75 else if (enemyType == 3)
76 {
77 movingSpeed = 1.2f;
78 }
79
80 life = lifeMax;
81
82 ShootingStart();
83 }
File name: Enemy.cs
Copy
99 public void Die()
100 {
101 GameObject bonus = pools.GetPoolableObject("bonus");
102 if (bonus != null)
103 {
104 bonus.SetActive(true);
105 bonus.GetComponent
106 }
107 if (enemyType == 4)
108 uiForScore.Win();
109 else
110 uiForScore.IncreaseScore(20);
111
112 transform.gameObject.SetActive(false);
113 }
File name: Pools.cs
Copy
76 public void AcivateBoss()
77 {
78 bossSystem.SetActive(true);
79 bossSystem.transform.position = new Vector3(Camera.main.transform.position.x, 0, Camera.main.transform.position.z);
80 bossSystem.GetComponentInChildren
81 }
File name: SpawnManager.cs
Copy
42 IEnumerator SpawningRoutine()
43 {
44 yield return new WaitForSeconds(3);
45
46 while (!UIgame.scoreAchived)
47 {
48 GameObject enemy = null;
49
50 //FIRST STAGE OF SPAWNING
51 //CHOOSE ENEMY FOR SPAWN
52 int r = rand.Randomization_1(0, 10, 80, 99);
53 if (r == 0)
54 {
55 enemy = pools.GetPoolableObject("enemy_01");
56 }
57 else if (r == 1)
58 {
59 enemy = pools.GetPoolableObject("enemy_02");
60 }
61 else
62 {
63 enemy = pools.GetPoolableObject("enemy_03");
64 }
65
66 //SECOND STAGE OF SPAWNING
67 //SPAWN CHOSEN ENEMY IN RANDOM POINT ON TOP SCREEN SIDE
68 r = Random.Range(0, pointsPositions.Length);
69
70 if (enemy != null)
71 {
72 enemy.SetActive(true);
73 enemy.GetComponent
74 new Vector3(0,0,-1));
75 }
76
77 int spawnDelay;
78 if (SystemScr.difficultyIsHard)
79 spawnDelay = 1;
80 else
81 spawnDelay = Random.Range(3,5);
82
83 yield return new WaitForSeconds(spawnDelay);
84 }
85
86 //BOSS ACTIVATION
87 pools.DeleteEnemiesAndBullets();
88 CameraMotor.speedScreen = 0;
89 Camera.main.GetComponent
90 Camera.main.GetComponent
91 Camera.main.backgroundColor = Color.black;
92 GameObject.FindObjectOfType
93
94 yield return new WaitForSeconds(6);
95
96 pools.AcivateBoss();
97 }
File name: Bonus.cs
Copy
25 public void Activation(Vector3 revealPosition)
26 {
27 transform.position = revealPosition;
28 RandomizeBonus();
29 }
Activation 143 lượt xem
Gõ tìm kiếm nhanh...