The Code 2

Step 1

The player and hamsa health was going below 0, so to get around this I added an if statement.

Step 2

Add an attack script for the Hamsa’s

Screen Shot 2017-04-03 at 11.11.13.png

Step 3

This attack is similar to the pulse.

Screen Shot 2017-04-03 at 11.16.57.png

Step 4

I attached it to the gameObject Hamsas which stores all the Hamsa’s.

Screen Shot 2017-04-03 at 11.17.09.png

Step 5

On the enemy script add a TakeDamage script which listens for the attack.timeUp.

I added in an update to check when the enemies health = 0 as this will end the game.

Screen Shot 2017-04-03 at 11.16.46.png

Step 6

Now I need the attack to start only when all the Hamsa’s have some health. I created a hamsaManager which contains a list of hamsa’s by tagging all the Hamsa – “Hamsa”.

Then for the length of the list I check if any of the Hamsa’s have 0 health, if they do, the manage sends a message of died = true.

Screen Shot 2017-04-03 at 11.50.10.png

Step 7

In my Attack script:

  • I added the OnEnable/OnDisable, for the HamsaManager died.
  • Then StopAttacking, which takes a bool of dead.
  • When a Hamsa has died it sends a message here to say that one is dead
    • But I need to add, the tell it to stop attacking.
  • In order for this all to work, the healing mechanics needs to be in.

Screen Shot 2017-04-03 at 11.55.40.png

Step 8

Creating a Tile Manager, the tile manager will look after the colour of the tiles, and is attached to the tile GameObject (which holds all the individual tiles)

Step 9

In the script I make a private GameObject list to store all my tiles, I then fill this list with all the GameObjects with the tag “Tile”

Screen Shot 2017-04-03 at 12.01.20.png

Step 10

Actually maybe it would be better to put this type of information into a level manager… I am going to make a new script. I make a new script and new empty GameObject in the hierarchy¬†and call it level, attaching the level manager to it.Screen Shot 2017-04-03 at 12.05.54.png

Step 11

In the Level Manager, I actually want lists of the:

  • tiles on the floor
  • hamsas on the floor
  • colours available?

Screen Shot 2017-04-03 at 12.11.15.png

Step 12

Back to the Hamsa Manager, I just call in the list made by the LevelManager

Screen Shot 2017-04-03 at 12.22.19.png

Step 13

I do the same for the tileManager

Screen Shot 2017-04-03 at 12.23.54.png

Step 14

Assign initial Colours in the tileManager:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s