// If the left mouse button was pressed down on this GameObject then we create // a new tenant, but deactivate it until we know the press was deliberate. void OnMouseDown() { newTenant = PlaceDefenceBehaviour.CreateDefender(); if (newTenant != null) { newTenant.SetActive(false); } }
void Deactivate() { if (Active()) { if (defenceInstance != null) { Destroy(defenceInstance); } defenceInstance = null; activeBehaviour = null; } }
void Activate() { if (!Active()) { if (activeBehaviour != null) { activeBehaviour.Deactivate(); } defenceInstance = Instantiate(defencePrefab); defenceInstance.layer = Helpers.LayerIgnoreRaycast; activeBehaviour = this; } if (!previouslyClicked) { previouslyClicked = true; MessageBoxBehaviour.Push("Messages/Icons/Scanner", "Messages/Text/InstallVirusScanner"); MessageBoxBehaviour.Push("Messages/Icons/PlacedVirusScanner", "Messages/Text/Money"); MessageBoxBehaviour.Show(); } }
void OnMouseEnter() { PlaceDefenceBehaviour.RegisterMouseOver(gameObject); }