Ejemplo n.º 1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Tower"))
     {
         Pubsub.Publish(Pubsub.Type.GameOver, null);
     }
 }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Entrypoint.Length != 0)
            {
                hash ^= Entrypoint.GetHashCode();
            }
            if (resources_ != null)
            {
                hash ^= Resources.GetHashCode();
            }
            if (triggers_ != null)
            {
                hash ^= Triggers.GetHashCode();
            }
            if (pubsub_ != null)
            {
                hash ^= Pubsub.GetHashCode();
            }
            hash ^= files_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 3
0
    void AddBloc(InteractiveBloc bloc)
    {
        tblocs.Add(bloc);
        bloc.transform.SetParent(transform);
        bloc.tag = "Tower";
        bloc.GetComponent <Rigidbody>().Sleep();
        // bloc.GetComponent<Rigidbody>().mass = 1000;

        Pubsub.Publish(Pubsub.Type.NewBlocOnTower, new object[] { tblocs.Count, bloc.gameObject });
    }
Ejemplo n.º 4
0
    void OnCollisionEnter(Collision other)
    {
        if (state != State.Dead && other.gameObject.CompareTag("Tower"))
        {
            state           = State.Dead;
            initialPosition = transform.position;

            Destroy(ligthspot);

            Pubsub.Publish(Pubsub.Type.BlocTouchTower, this);
        }
    }
Ejemplo n.º 5
0
 public void MergeFrom(JobSpec other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Name.Length != 0)
     {
         Name = other.Name;
     }
     if (other.Entrypoint.Length != 0)
     {
         Entrypoint = other.Entrypoint;
     }
     if (other.resources_ != null)
     {
         if (resources_ == null)
         {
             Resources = new global::Toit.Proto.Model.JobResources();
         }
         Resources.MergeFrom(other.Resources);
     }
     if (other.triggers_ != null)
     {
         if (triggers_ == null)
         {
             Triggers = new global::Toit.Proto.Model.JobTriggers();
         }
         Triggers.MergeFrom(other.Triggers);
     }
     if (other.pubsub_ != null)
     {
         if (pubsub_ == null)
         {
             Pubsub = new global::Toit.Proto.Model.JobSpec.Types.PubSub();
         }
         Pubsub.MergeFrom(other.Pubsub);
     }
     files_.Add(other.files_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Ejemplo n.º 6
0
 public void Dispose()
 {
     Pubsub.Unregister(type, callback);
 }
Ejemplo n.º 7
0
 public PubsubHandler(Pubsub.Type type, Action <object> callback)
 {
     Pubsub.Register(type, callback);
     this.callback = callback;
     this.type     = type;
 }
Ejemplo n.º 8
0
    void InstantiateNewBloc()
    {
        GameObject bloc = Instantiate(blocPrefab);

        Pubsub.Publish(Pubsub.Type.NewInteractiveBloc, bloc);
    }