void Start()
 {
     recentEffectTime  = -effectDelay;
     collideEffect.UID = DrugEffect.generateUID();
     motor             = (CharacterController)gameObject.GetComponent("CharacterController");
     health            = GetComponent <EnemyHealth>();
 }
Exemple #2
0
        /// <summary>
        /// Zatrzymuje efekt narkotyków dla podanego gracza.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="effectId"></param>
        public static void StopEffectForPlayer(Client player, int effectId)
        {
            DrugEffect effectData = GetDrugEffect(effectId);

            if (effectData == null)
            {
                return;
            }
            NAPI.ClientEvent.TriggerClientEvent(player, "client.drugs.stopEffect", effectData.EffectName);
        }
Exemple #3
0
        /// <summary>
        /// In a target model, finds the drugs that could have the desired effect on the target node.
        /// </summary>
        /// <param name="model">The target model</param>
        /// <param name="nodeId">The Id of the target node</param>
        /// <param name="drugEffect">The desired effect</param>
        /// <param name="drugsList">The list of available drugs</param>
        /// <param name="drugNodes">The new nodes added for the drugs</param>
        /// <param name="drugsEdges">The new edges added for the drugs</param>
        public void FindDrugs(BinaryModel model, string nodeId, DrugEffect drugEffect, List <DrugDescription> drugsList, out List <BinaryNode> drugNodes, out List <BinaryEdge> drugsEdges)
        {
            drugNodes  = new List <BinaryNode>();
            drugsEdges = new List <BinaryEdge>();
            var node = model.GetNode(nodeId);

            if (node.State != State.Unset)
            {
                return;
            }
            node.State = drugEffect == DrugEffect.Activation ? State.Active : State.Inactive;
            var targetDrug = drugsList.FirstOrDefault(d => d.TargetId.Equals(nodeId) && d.Effect == drugEffect);

            if (targetDrug != null)
            {
                var drugNode = new BinaryNode(model, targetDrug.Id);
                drugNode.State = State.Active;
                drugNodes.Add(drugNode);
                var drugEdge = new BinaryEdge(model, string.Concat(targetDrug.Id, node.Id), targetDrug.Effect == DrugEffect.Activation ? EdgeType.Positive : EdgeType.Negative);
                drugEdge.Input  = drugNode;
                drugEdge.Output = node;
                drugsEdges.Add(drugEdge);
            }
            foreach (var edge in model.Edges.Where(e => e.Output == node))
            {
                var modelClone  = model.Clone();
                var inputEffect = DrugEffect.Activation;
                switch (edge.Type)
                {
                case EdgeType.Positive:
                    inputEffect = drugEffect;
                    break;

                case EdgeType.Negative:
                    inputEffect = drugEffect == DrugEffect.Activation
                            ? DrugEffect.Inhibition
                            : DrugEffect.Activation;
                    break;
                }
                FindDrugs(modelClone, edge.Input.Id, inputEffect, drugsList, out var newDrugNodes, out var newDrugEdges);
                drugNodes.AddRange(newDrugNodes);
                drugsEdges.AddRange(newDrugEdges);
            }
        }
Exemple #4
0
 public void addEffect(DrugEffect effect)
 {
     effects.Add(effect);
 }
Exemple #5
0
 /// <summary>
 /// Add another effect to the player.
 /// </summary>
 /// <param name='effect'>
 /// The effect to add.
 /// </param>
 public void addEffect(DrugEffect effect)
 {
     effects.Add(effect);
 }
Exemple #6
0
 public TargetPhenotype(string phenotypeId, DrugEffect effect)
 {
     PhenotypeId = phenotypeId;
     Effect      = effect;
 }
Exemple #7
0
 public DrugDescription(string id, string targetId, DrugEffect effect)
 {
     Id       = id;
     TargetId = targetId;
     Effect   = effect;
 }