コード例 #1
0
        /// <summary>
        /// Retourne la collection filtrée.
        /// </summary>
        /// <param name="collection">La collection à filtrer.</param>
        /// <returns>La collection filtrée.</returns>
        /// <remarks>Utilisé dans Kinetix.WebControls.</remarks>
        public static ICollection Filter(ICollection collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }

            Type collectionType = collection.GetType();

            Type[] innerTypes = collectionType.GetGenericArguments();
            if (innerTypes.Length != 1)
            {
                throw new NotSupportedException();
            }

            Type genericType = typeof(List <>).MakeGenericType(innerTypes[0]);

            if (!(genericType is IActivable))
            {
                return(collection);
            }

            IList newCollection = (IList)Activator.CreateInstance(genericType);

            foreach (object obj in collection)
            {
                IActivable iActivable = obj as IActivable;
                if (iActivable != null && iActivable.IsActif != null && iActivable.IsActif == true)
                {
                    newCollection.Add(obj);
                }
            }

            return(newCollection);
        }
コード例 #2
0
ファイル: DoorsButtonsManager.cs プロジェクト: supernikx/Poxy
    public void Init()
    {
        if (!doorsContainer || !buttonsContainer)
        {
            return;
        }

        //tokenMng = _tokenMng;

        for (int i = 0; i < doorsContainer.childCount; i++)
        {
            IActivable _current = doorsContainer.GetChild(i).GetComponent <IActivable>();
            if (_current != null)
            {
                _current.Init();
                doors.Add(_current);
            }
        }

        for (int i = 0; i < buttonsContainer.childCount; i++)
        {
            IButton _current = buttonsContainer.GetChild(i).GetComponent <IButton>();
            if (_current != null)
            {
                _current.Init();
                buttons.Add(_current);
            }
        }

        //tokenMng.FinishToken += HandleFinishToken;
        LevelManager.OnPlayerDeath += HandlePlayerDeath;
    }
コード例 #3
0
 void Start()
 {
     attachedActivables = new List <IActivable>();
     foreach (GameObject element in attachedObjects)
     {
         IActivable activableComponent = element.GetComponent <IActivable>();
         attachedActivables.Add(activableComponent);
     }
 }
コード例 #4
0
    public static void Activate(this IActivable source)
    {
        if (null == source)
        {
            throw new ArgumentNullException("source");
        }

        source.IsActive = true;
    }
コード例 #5
0
    protected virtual void Start()
    {
        _activable = _activableObject?.GetComponent <IActivable>() ?? _activableObject?.GetComponentInChildren <IActivable>() ?? _activableObject?.GetComponentInParent <IActivable>();

        SetActiveColor(_active);

        if (_triggerOnStart)
        {
            SetActive(_active);
        }
    }
コード例 #6
0
ファイル: ColliderButton.cs プロジェクト: supernikx/Poxy
 public override void Activate()
 {
     foreach (GameObject _current in targets)
     {
         IActivable _temp = _current.GetComponent <IActivable>();
         if (_temp != null)
         {
             _temp.Activate();
         }
     }
 }
コード例 #7
0
    // Use this for initialization
    public void Start () {

        //Inicializacion del puzzle
        //Guarda las referencias a los scripts de los objetos
        //Y marca los objetos como parte del puzzle para que adapten su comportamiento
        UsableObject aux;
        foreach(GameObject o in objectList)
        {
            aux = o.GetComponent<UsableObject>();
            aux.puzzleManager = this;
            aux.inPuzzle = true;
            usables.Add(aux);           
        }
        targetActivable = result.GetComponent<IActivable>();

	
	}
コード例 #8
0
    private void OnTriggerStay(Collider other)
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            Debug.Log("GTFO mundo TOMAR" + other.gameObject.name);

            IActivable activador = other.gameObject.GetComponent <IActivable>();

            if (activador is null)
            {
                return;
            }

            activador.Activar();
            Brazo.LongitudMaxima += Multiplicador;
        }
    }
コード例 #9
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            alcance.OverlapCollider(new ContactFilter2D().NoFilter(), results);

            IActivable activable = results.FirstOrDefault(c => c.gameObject.GetComponent <IActivable>() != null)?.GetComponent <IActivable>();

            Debug.Log("Click + " + activable?.ToString());
            if (activable is null)
            {
                return;
            }

            activable.Activar();
        }
    }
コード例 #10
0
ファイル: TriggerBase.cs プロジェクト: DominicBg/NotreProjet
 public virtual void Initialize()
 {
     //Si il y a des objets dans le tableau
     if (objectsToActive != null)
     {
         IActivable[] temp = new IActivable[objectsToActive.Length];
         for (int i = 0; i < temp.Length; i++)
         {
             IActivable tempz = objectsToActive[i].GetComponent <IActivable>();
             if (tempz != null)
             {
                 temp[i] = tempz;
             }
         }
         activables = temp;
     }
     else if (objectsToActive == null || objectsToActive.Length == 0)
     {
         Debug.Log(this + " Tableau d'objet a activer vide!");
     }
 }
コード例 #11
0
ファイル: Player.cs プロジェクト: akrem1st/Assignment2d
 /// <summary>
 /// the player can turn on the feature of any item he is carrying such as flashlight and lightsource of location
 /// </summary>
 /// <param name="item"></param>
 public override void EnableFeature(IActivable item)
 {
     if (Items.Any(i => i.ToString() == item.ToString()))
     {
         (Items.First(i => i.ToString() == item.ToString()) as IActivable).Enable();
         if (CurrentLocation is NoDayLightLocation && item is FlashLight)
             (CurrentLocation as NoDayLightLocation).FlashLightOn = true;
     } else {
         Console.WriteLine("You don't have this feature");
     }
 }
コード例 #12
0
 public AreaTrigger(int x, int y, int w, int h, IActivable target = null)
     : base(x, y)
 {
     this.width = w;
     this.height = h;
     this.target = target;
 }
コード例 #13
0
        public override void update()
        {
            base.update();

            if (target == null)
            {
                if (targetId > 0)
                {
                    bEntity e = world.find(targetId);
                    if (e is IActivable)
                        target = e as IActivable;
                    else return;
                }
            }

            if (placeMeeting(x, y, "player"))
                target.activate(null);
            else
                target.deactivate(null);
        }
コード例 #14
0
ファイル: Actor.cs プロジェクト: akrem1st/Assignment2d
 public virtual void EnableFeature(IActivable activable)
 {
 }
コード例 #15
0
ファイル: PressionPlat.cs プロジェクト: GlintGame/Glint
 private void Awake()
 {
     this.activable = this.ToActivate.GetComponent <IActivable>();
 }
コード例 #16
0
 private void Start()
 {
     interfaceActivable = objectToActivate.GetComponent <IActivable>();
 }
コード例 #17
0
ファイル: Player.cs プロジェクト: akrem1st/Assignment2d
 /// <summary>
 /// the player can turn off the feature of the item he is carrying
 /// </summary>
 /// <param name="item"></param>
 public override void DisableFeature(IActivable item)
 {
     if (Items.Any(i => i.ToString() == item.ToString()))
     {
         (Items.First(i => i.ToString() == item.ToString()) as IActivable).Disable();
         if (CurrentLocation is NoDayLightLocation && item is FlashLight)
             (CurrentLocation as NoDayLightLocation).FlashLightOn = false;
     } else
     {
         Console.WriteLine("You don't have this feature.");//warns the user if thwere is no ityem that he is carrying
     }
 }
コード例 #18
0
    protected virtual void Start()
    {
        _activable = _activableObject?.GetComponent <IActivable>() ?? _activableObject?.GetComponentInChildren <IActivable>() ?? _activableObject?.GetComponentInParent <IActivable>();

        SetActiveColor(AccessGrant.None);
    }