public void DeleteAutoTest()
        {
            var autoDto = AutoTarget.GetById(1);

            AutoTarget.Delete(autoDto);
            Assert.Throws <FaultException <UnknownFault> >(() => AutoTarget.GetById(1));
        }
Example #2
0
 public GeneralProperties(ScriptContext context, Actor self)
     : base(context, self)
 {
     facing     = self.TraitOrDefault <IFacing>();
     autotarget = self.TraitOrDefault <AutoTarget>();
     scriptTags = self.TraitOrDefault <ScriptTags>();
 }
        public void UpdateAutoTest()
        {
            var autoDto = AutoTarget.GetById(2);

            autoDto.Marke = "Jugo";
            AutoTarget.Update(autoDto);
        }
Example #4
0
            void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
            {
                // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
                if (newStance > oldStance || forceAttack)
                {
                    return;
                }

                if (target.Type == TargetType.Actor)
                {
                    var a = target.Actor;
                    if (!autoTarget.HasValidTargetPriority(self, a.Owner, a.GetEnabledTargetTypes()))
                    {
                        Cancel(self, true);
                    }
                }
                else if (target.Type == TargetType.FrozenActor)
                {
                    var fa = target.FrozenActor;
                    if (!autoTarget.HasValidTargetPriority(self, fa.Owner, fa.TargetTypes))
                    {
                        Cancel(self, true);
                    }
                }
            }
Example #5
0
    void Awake()
    {
        _rb = GetComponent <Rigidbody>();
        AnimationPillow.SetActive(false);

        _autoTarget = GetComponent <AutoTarget>();
    }
 public AttackMoveActivity(Actor self, Func <Activity> getInner, bool assaultMoving = false)
 {
     this.getInner    = getInner;
     autoTarget       = self.TraitOrDefault <AutoTarget>();
     conditionManager = self.TraitOrDefault <ConditionManager>();
     attackMove       = self.TraitOrDefault <AttackMove>();
     isAssaultMove    = assaultMoving;
 }
Example #7
0
 public AttackMoveActivity(Actor self, Func <Activity> getMove, bool assaultMoving = false)
 {
     this.getMove     = getMove;
     autoTarget       = self.TraitOrDefault <AutoTarget>();
     attackMove       = self.TraitOrDefault <AttackMove>();
     isAssaultMove    = assaultMoving;
     ChildHasPriority = false;
 }
Example #8
0
 public GeneralProperties(ScriptContext context, Actor self)
     : base(context, self)
 {
     facing     = self.TraitOrDefault <IFacing>();
     autotarget = self.TraitOrDefault <AutoTarget>();
     scriptTags = self.TraitOrDefault <ScriptTags>();
     tooltips   = self.TraitsImplementing <Tooltip>().ToArray();
 }
        public void UpdateAutoWithOptimisticConcurrencyTest()
        {
            var autoDto = AutoTarget.GetById(2);

            autoDto.Marke = "Jugo";
            AutoTarget.Update(autoDto);
            autoDto.Marke = "VW";
            Assert.Throws <FaultException <OptimisticConcurrencyFault> >(() => AutoTarget.Update(autoDto));
        }
Example #10
0
    void Awake()
    {
        InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
        InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerAxis);
        InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerButtons);

        _child = GetComponent<Child>();
        _autoTarget = GetComponent<AutoTarget>();
        _child.Index = (int)PlayerNumber;
    }
Example #11
0
    void Awake()
    {
        InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
        InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerAxis);
        InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerButtons);

        _child       = GetComponent <Child>();
        _autoTarget  = GetComponent <AutoTarget>();
        _child.Index = (int)PlayerNumber;
    }
Example #12
0
        void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
        {
            // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
            if (newStance > oldStance || forceAttack)
            {
                return;
            }

            if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
            {
                target = Target.Invalid;
            }
        }
Example #13
0
 private void Start()
 {
     targeting = GetComponent <AutoTarget>();
     try
     {
         ammoParent = GameObject.Find("BulletCollector").transform;
     }
     catch
     {
         Debug.LogError(this + " requires that an empty object named 'BulletCollector' be placed in the scene. Creating object for you.");
         ammoParent = new GameObject("BulletCollector").transform;
     }
 }
        public void InsertAutoTest()
        {
            var autoDto = new AutoDto
            {
                AutoKlasse = (int)AutoKlasse.Luxusklasse,
                Basistarif = 50,
                Marke      = "Audi C3"
            };

            AutoTarget.Insert(autoDto);
            var autoDtoInserted = AutoTarget.GetById(5);

            Assert.Equal(50, autoDtoInserted.Basistarif);
        }
Example #15
0
        void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
        {
            // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
            if (newStance > oldStance || forceAttack)
            {
                return;
            }

            // If lastVisibleTarget is invalid we could never view the target in the first place, so we just drop it here too
            if (!lastVisibleTarget.IsValidFor(self) || !autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
            {
                attackAircraft.ClearRequestedTarget();
            }
        }
Example #16
0
    private void FixedUpdate()
    //walkDirection: 1 = left, 2 = up, 3 = right, 4 = down;
    //idleDirection: saves previous walkDirection to animate idle
    {
        float dx = 0;
        float dy = 0;

        if (!gameObject.GetComponent <Status>().isStunned)
        {
            if (Input.GetAxisRaw("Vertical") > 0)
            {
                anim.SetInteger("direction", 2);
                anim.SetFloat("velocity", 1.0f);
                previousDirection = 2;
                dy = 1;
            }
            if (Input.GetAxisRaw("Horizontal") < 0)
            {
                //anim.SetBool("a", true);
                //anim.SetBool("d", false);

                anim.SetInteger("direction", 1);
                anim.SetFloat("velocity", 1.0f);
                previousDirection = 3;
                dx = -1;
            }
            if (Input.GetAxisRaw("Vertical") < 0)
            {
//				if (!Input.GetKey (KeyCode.A) && !Input.GetKey (KeyCode.LeftArrow))
                anim.SetInteger("direction", 4);
                anim.SetFloat("velocity", 1.0f);
                previousDirection = 4;
                dy = -1;
            }
            if (Input.GetAxisRaw("Horizontal") > 0)
            {
//				Vector3 theScale = transform.localScale;
//				theScale.x = 1;
//				transform.localScale = theScale;

                anim.SetInteger("direction", 1);
                anim.SetFloat("velocity", 1.0f);
                previousDirection = 1;
                dx = 1;
            }
            //
            if (Input.GetButton("Heal"))
            {
                SelfCast.cast(gameObject);
            }

            if (Input.GetButton("PoisonCloud"))
            {
                SelfCast2.cast(gameObject);
            }

            if (Input.GetButton("Fireball"))
            {
                AutoTarget.cast(cStat.FindClosestEnemy());
            }

            if (Input.GetButton("Clayball"))
            {
                AutoTarget2.cast(cStat.FindClosestEnemy());
            }
            if (Input.GetMouseButtonDown(0))
            {
                PosTarget.cast(Input.mousePosition);
            }
        }
        //if not moving
        if (!PlayerInput.isMoving())
        {
            anim.SetInteger("direction", previousDirection);
            anim.SetFloat("velocity", 0.0f);
        }

        this.setDirection(new Vector3(dx, dy, 0));
        Move();

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (paused)
            {
                paused           = false;
                playerGUI.paused = false;
            }
            else
            {
                paused           = true;
                playerGUI.paused = true;
            }
        }

        if (gameObject.GetComponent <Status>() != null && gameObject.GetComponent <Status> ().getHealth() < 0)
        {
            Die();
        }

        UpdateGameState();
    }
Example #17
0
 private void Start()
 {
     singleton = this;
 }
Example #18
0
    void FixedUpdate()
    {
        ai.fpscounter++;
        aidirection = attackingg.transform.position - gameObject.transform.position;

        RaycastHit2D hit = Physics2D.Raycast(gameObject.transform.position, aidirection, 12.0f, Wall);

        if (hit.collider != null && hit.collider.tag == "Player")
        {
            visible = true;
        }
        else
        {
            visible = false;
        }

        if (visible)
        {
            if (getDistance(attackingg) < 10.0f)
            {
                this.setDirection(aidirection);
                Move();
                isBlindlyChasing = false; //name innacurate because of this, but #YOLO
            }
            else
            {
                isBlindlyChasing = true;
            }
            if (isWandering && getDistance(attackingg) >= 10.0f)
            {
                actuallyRePath(attackingg.transform.position);
            }

            isWandering  = false;
            lastTimeSeen = Time.time;
        }
        else if (!visible && (Time.time - lastTimeSeen < chaseTimeOut))
        {
            isBlindlyChasing = true;
            isWandering      = false;
        }
        else
        {
            if (isBlindlyChasing)
            {
                actuallyRePath(attackingg.transform.position);
            }
            isWandering      = true;
            isBlindlyChasing = false;
        }



        if (isWandering)
        {
            if (ai.currentNode == null)
            {
                eTile[,] map = mapgen.currentFloor();
                Location randomPlace;
                do
                {
                    randomPlace = new Location(Random.Range(0, map.GetLength(0)), Random.Range(0, map.GetLength(1)));
                }while (map[randomPlace.x, randomPlace.y] != eTile.Floor);

                randomTarget = new Vector3(randomPlace.x, randomPlace.y, 0);

                PathFindTowards(randomTarget);
            }
            else
            {
                PathFindTowards(randomTarget);
            }
        }

        if (isBlindlyChasing)
        {
            PathFindTowards(attackingg.transform.position);
        }



        if (name.Equals("Ghost") && getDistance(attackingg) < 60 && GetComponent <Status>().see)
        {
            //if (getDistance (attackingg) < 60 && GetComponent<Status>().see) {
            AutoTarget.cast(attackingg);
            //Debug.Log ("123");
            //Debug.Log(attackingg.tag);
        }
    }
Example #19
0
 public GeneralProperties(ScriptContext context, Actor self)
     : base(context, self)
 {
     facing = self.TraitOrDefault<IFacing>();
     autotarget = self.TraitOrDefault<AutoTarget>();
     scriptTags = self.TraitOrDefault<ScriptTags>();
 }
 void Update()
 {
     _autoTarget = GetComponentInChildren <AutoTarget>();
 }
Example #21
0
 public AttackMoveActivity( Actor self, Activity inner )
 {
     this.inner = inner;
     this.autoTarget = self.TraitOrDefault<AutoTarget>();
 }
Example #22
0
    void Awake()
    {
        _rb = GetComponent<Rigidbody>();
        AnimationPillow.SetActive(false);

        _autoTarget = GetComponent<AutoTarget>();
    }
 public ControllerOptions(AutoTarget danAutoTarget)
 {
     this.danAutoTarget = danAutoTarget;
 }
 public void GetAutoByIdTest()
 {
     Assert.Equal("Fiat Punto", AutoTarget.GetById(1).Marke);
 }
 public void GetAutosTest()
 {
     Assert.Equal(4, AutoTarget.GetAll().Count);
 }
Example #26
0
 public AttackMoveActivity(Actor self, Activity inner)
 {
     this.inner = inner;
     autoTarget = self.TraitOrDefault <AutoTarget>();
 }
Example #27
0
 // Start is called before the first frame update
 void Start()
 {
     _target      = GameObject.Find("Player").transform.GetChild(0).gameObject;
     _laserTarget = transform.GetChild(0).GetComponent <AutoTarget>();
 }
Example #28
0
 public GeneralProperties(Actor self)
     : base(self)
 {
     facing = self.TraitOrDefault<IFacing>();
     autotarget = self.TraitOrDefault<AutoTarget>();
 }
 public void GetAutoByIdWithIllegalIdTest()
 {
     Assert.Throws <FaultException <UnknownFault> >(() => AutoTarget.GetById(100));
 }
Example #30
0
 public GeneralProperties(Actor self) : base(self)
 {
     facing     = self.TraitOrDefault <IFacing>();
     autotarget = self.TraitOrDefault <AutoTarget>();
 }