// 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);
     }
 }
示例#2
0
 void Deactivate()
 {
     if (Active())
     {
         if (defenceInstance != null)
         {
             Destroy(defenceInstance);
         }
         defenceInstance = null;
         activeBehaviour = null;
     }
 }
示例#3
0
    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);
 }