Example #1
0
 void Start()
 {
     ownerArrowController     = ownerArrow.GetComponent <ArrowController> ();
     lineRenderer             = transform.GetComponent <LnRenderer> ();
     beingHeldLineRenderer    = transform.GetChild(2).GetComponent <LnRenderer> ();
     availableGuideLineLength = ownerArrowController.speed * GameController.getInstance().getDeltaTime();
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "prize")
        {
            Debug.Log("Collision with " + other.gameObject.tag);
            Player.Instance.Points += 10;
            AudioSource coinSound =
                gameObject.GetComponent <AudioSource> ();
            if (coinSound != null)
            {
                coinSound.Play();
            }
        }
        else if (other.gameObject.tag == "fire")
        {
            Debug.Log("Collision with " + other.gameObject.tag);
            Player.Instance.Health -= 10;
        }

        ArrowController sp = other.gameObject.GetComponent <ArrowController> ();

        if (sp != null)
        {
            sp.Reset();
        }
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
 private void Awake()
 {
     if (controller == null)
     {
         controller = this;
     }
 }
Example #5
0
    private void ShowAllPilotsArrows()
    {
        if (!AllPilotsArrowsShown)
        {
            foreach (var inactiveObject in InactiveObjectsToActivateOnFirstPilot)
            {
                inactiveObject.SetActive(true);

                ArrowController arrowController = inactiveObject.GetComponent <ArrowController>();
                if (arrowController)
                {
                    arrowController.Blink(2);
                }
                else
                {
                    PilotController pilotController = inactiveObject.GetComponent <PilotController>();
                    if (pilotController)
                    {
                        ActivePilots.Add(pilotController);
                    }
                }
            }

            AllPilotsArrowsShown = true;
        }
    }
Example #6
0
    protected virtual void Start()
    {
        pathfinder = new Pathfinder(gameObject);
        path       = new List <Vector3>();

        arrowController = new ArrowController(arrow, this.gameObject, mainCamera);
    }
Example #7
0
 void Start()
 {
     arrowCtrl = GetComponent <ArrowController>();
     uiCtrl    = canvas.GetComponent <UIController>();
     uiCtrl.SetReplayBtnVisibility(false);
     uiCtrl.replayBtn.onClick.AddListener(() => Replay());
 }
 private void chooseArrowType(ArrowController arrowType)
 {
     selectedArrow       = arrowType;
     rend.material.color = selectedArrow.GetComponent <Renderer>().sharedMaterials[2].color;
     GetComponent <AudioSource> ().clip = arrowSwitchSound;
     GetComponent <AudioSource> ().Play();
 }
Example #9
0
    void Launch(float angle)
    {
        void LaunchOne(float dangle)
        {
            GameObject      arrowObject = Instantiate(arrowPrefab, rigidBody2D.position + new Vector2(0.2f, 0.1f), Quaternion.identity);
            ArrowController ac          = arrowObject.GetComponent <ArrowController>();

            ac.Launch(dangle, arrowForce, arrowDommage);
        }

        if (arrowCount > 2.9f)
        {
            LaunchOne(angle + 20);
            LaunchOne(angle - 20);
        }
        if (arrowCount > 4.9f)
        {
            LaunchOne(angle + 10);
            LaunchOne(angle - 10);
        }
        if (arrowCount > 5.9f)
        {
            LaunchOne(angle + 5);
            LaunchOne(angle - 5);
        }
        if (arrowCount > 6.9f)
        {
            LaunchOne(angle + 15);
            LaunchOne(angle - 15);
        }
        LaunchOne(angle);
    }
Example #10
0
    void Shoot()
    {
        ArrowController arrowToShoot = GameManager.Instance.GetArrow(transform.position).GetComponent <ArrowController>();

        arrowToShoot.Owner        = player.gameObject;
        arrowToShoot.transform.up = player.AimDirection;
    }
Example #11
0
    public void ShootBow(float speedX, float speedY)
    {
        if (speedX >= arrowMaxVelocity)
        {
            speedX = arrowMaxVelocity;
        }

        if (bowActive && !crouch && arrowsInQuiver > 0 && !dead && canStab)
        {
            canStab = false;
            StartCoroutine(SecondAttackDelay());
            animator.SetTrigger(shootForwardHash);
            GameObject arrow = Instantiate(arrowPrefab, arrowStartPoint.position, arrowStartPoint.transform.rotation);
            arrow.GetComponent <Rigidbody2D>().velocity = new Vector2(speedX * 2 * transform.right.x, -speedY * 2);
            arrowsInQuiver--;

            if (fireArrowsInQuiver > 0)
            {
                ArrowController arrowController = arrow.GetComponent <ArrowController>();
                arrowController.IncreaseDamage();
                arrowController.StartParticles();
                fireArrowsInQuiver--;
            }
        }
    }
Example #12
0
    IEnumerator attackSync(Transform trans)
    {
        yield return(new WaitForSeconds(1.15f));

        if (playerController.canSplite)
        {
            trans.Rotate(5, 0, 0);
            GameObject      arrowleft        = Instantiate(arrowPrefab, leftHandTrans.position, trans.rotation);
            ArrowController arrowController1 = arrowleft.GetComponent <ArrowController>();
            arrowController1.teamFrom = this.tag;
            arrowController1.damage   = playerController.damage;
            trans.Rotate(-10, 0, 0);
            GameObject      arrowright       = Instantiate(arrowPrefab, leftHandTrans.position, trans.rotation);
            ArrowController arrowController2 = arrowright.GetComponent <ArrowController>();
            arrowController2.teamFrom = this.tag;
            arrowController2.damage   = playerController.damage;
            NetworkServer.Spawn(arrowleft);
            NetworkServer.Spawn(arrowright);
            trans.Rotate(5, 0, 0);
        }

        GameObject      arrow           = Instantiate(arrowPrefab, leftHandTrans.position, trans.rotation);
        ArrowController arrowController = arrow.GetComponent <ArrowController>();

        arrowController.teamFrom = this.tag;
        arrowController.damage   = playerController.damage;
        NetworkServer.Spawn(arrow);
        yield break;
    }
Example #13
0
    public void Shoot()
    {
        ArrowController newArrow = ActiveArrow();

        newArrow.transform.position = firePoint.position;
        newArrow.transform.rotation = firePoint.rotation;
        isFiring = false;
    }
Example #14
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject collistionObject = collision.gameObject;

        switch (collistionObject.tag)
        {
        case "Hero":
            if (currentTarget == TargetType.Hero)
            {
                HeroSpine heroSpine = collistionObject.GetComponent <HeroSpine>();
                heroSpine.GetHit(AttackBlood);
                Destroy(gameObject);
            }
            break;

        case "Enemy":
            if (currentTarget == TargetType.Enemy)
            {
                if (isAttacked)
                {
                    return;
                }
                EnemySpine enemySpine = collistionObject.GetComponent <EnemySpine>();
                enemySpine.GetHit(AttackBlood);
                switch (arrowType)
                {
                case ArrowType.rain:
                    if (!isAttacked)
                    {
                        isAttacked = true;
                    }
                    break;

                default:
                    Destroy(gameObject);
                    break;
                }
            }
            break;

        case "Arrow":
            ArrowController otherArrow = collistionObject.GetComponent <ArrowController>();
            if (otherArrow.Target != currentTarget)
            {
                Destroy(gameObject);
            }
            break;

        case "Down":
            if (arrowType == ArrowType.rain)
            {
                EventManager.Send("ArrowRainRecord");
                EventManager.Send <Vector3>("HeroRainPlay", transform.localPosition);
            }
            Destroy(gameObject);
            break;
        }
    }
Example #15
0
        public void MovementSuccess()
        {
            ArrowController ac = new ArrowController(10, 10);
            ac.Right(5);
            ac.Left(2);
            ac.Forward(3);

            Assert.AreNotEqual(0, ac.Arrow.X);
        }
Example #16
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     print("collide");
     if (collision.gameObject.GetComponent <ArrowController>())
     {
         ArrowController controller = collision.gameObject.GetComponent <ArrowController>();
         controller.CancelInvoke();
     }
 }
Example #17
0
    protected override void activateWind()
    {
        StartCoroutine(lerpBallToCenter());
        ballCont = ball.GetComponent <BallController>();
        ac       = ballCont.arrowController;


        TutorialController.instance.openTutorial("kickWind");
    }
Example #18
0
    public void Add(ObjectInfo info, bool myPlayer = false)
    {
        GameObjectType objectType = GetObjectTypeById(info.ObjectId);

        if (objectType == GameObjectType.Player)
        {
            if (myPlayer == true)
            {
                GameObject go = Managers.Resource.Instantiate("Creature/MyPlayer");
                go.name = info.Name;
                _objects.Add(info.ObjectId, go);

                MyPlayer         = go.GetComponent <MyPlayerController>();
                MyPlayer.Id      = info.ObjectId;
                MyPlayer.PosInfo = info.PosInfo;
                MyPlayer.Stat    = info.StatInfo;
                MyPlayer.SyncPos();
            }
            else
            {
                GameObject go = Managers.Resource.Instantiate("Creature/Player");
                go.name = info.Name;
                _objects.Add(info.ObjectId, go);

                PlayerController pc = go.GetComponent <PlayerController>();
                pc.Id      = info.ObjectId;
                pc.PosInfo = info.PosInfo;
                pc.Stat    = info.StatInfo;
                pc.SyncPos();
            }
        }
        else if (objectType == GameObjectType.Monster)
        {
            GameObject go = Managers.Resource.Instantiate("Creature/Monster");
            go.name = info.Name;
            _objects.Add(info.ObjectId, go);

            MonsterController mc = go.GetComponent <MonsterController>();
            mc.Id      = info.ObjectId;
            mc.PosInfo = info.PosInfo;
            mc.Stat    = info.StatInfo;
            mc.SyncPos();
        }
        else if (objectType == GameObjectType.Projectile)
        {
            GameObject go = Managers.Resource.Instantiate("Creature/Arrow");
            go.name = "Arrow";
            _objects.Add(info.ObjectId, go);

            ArrowController ac = go.GetComponent <ArrowController>();
            ac.PosInfo = info.PosInfo;
            ac.Stat    = info.StatInfo;
            //ac.Dir = info.PosInfo.Movedir;
            //ac.CellPos = new Vector3Int(info.PosInfo.PosX, info.PosInfo.PosY, 0);
            ac.SyncPos();
        }
    }
Example #19
0
    /// <summary>
    /// 创建箭矢
    /// </summary>
    /// <param name="index">箭矢序号</param>
    /// <param name="targetType">目标类型</param>
    public virtual void CreateArrow(int index, TargetType targetType)
    {
        ArrowController createArrow = GameObject.Instantiate(arrowGroup[index]);

        createArrow.transform.SetParent(transform.parent);
        createArrow.transform.localScale = new Vector3(1, 1, 1);
        createArrow.transform.position   = AttackPos.transform.position;
        createArrow.SetTarget(targetType);
    }
Example #20
0
 void ShootArrow()
 {
     if (!isHit)
     {
         audioCont.PlaySound(shootSound);
         ArrowController arrowCont = arrowInstance.GetComponent<ArrowController>();
         if (abilityIndex == 4 && !isNoble) { arrowCont.SetRicochetAbility(1, this); }
         arrowCont.Shoot((200 + (50 * timeFactor)), isNoble, true, player.transform.position);
     }
 }
Example #21
0
    private void Arrow_onArrowHit(ArrowController caller, TreeCollider.CollisionInfo ci)
    {
        var bird = ci.collidedWith.GetComponentInParent <BirdController>();

        if (bird != null)
        {
            StatsViewController.SetScore(++totalScore);
            StatsViewController.SetArrowsHit(++totalArrowsHit);
        }
    }
 void Start()
 {
     arrowController = GameObject.FindObjectOfType <ArrowController>();
     if (arrowController == null)
     {
         return;
     }
     arrowController.enabled = false; //TODO:  Make this thing work right
     arrowController.gameObject.SetActive(false);
 }
Example #23
0
    // Update is called once per frame
    void Update()
    {
        GameObject player = GameObject.Find("Player");

        ArrowController ship = player.GetComponent <ArrowController>();

        //Debug.Log(ship.boostLevel);

        boostBar.value = ship.boostLevel;
    }
Example #24
0
 //private void Target_onArrowHit(TargetController caller, ArrowController arrow)
 //{
 //PlayHitAt(caller.transform.position);
 //}
 private void Bowman_onArrowShot(ArrowController arrow)
 {
     arrow.onArrowHit += Arrow_onArrowHit;
     StatsViewController.SetArrowsShot(SceneController.sceneControllerInScene.bowman.totalArrowsFired - startArrowsFiredCount);
     StatsViewController.SetArrowsHit(totalArrowsHit);
     if (inGame && GetArrowsLeft() <= 0)
     {
         DoEndGameSequence();
     }
 }
Example #25
0
        public void MovementSuccess()
        {
            ArrowController ac = new ArrowController(10, 10);

            ac.Right(5);
            ac.Left(2);
            ac.Forward(3);

            Assert.AreNotEqual(0, ac.Arrow.X);
        }
Example #26
0
 void Awake()
 {
     player        = GetComponent <Player> ();
     navAgent      = GetComponent <NavMeshAgent> ();
     playerAnim    = GetComponent <Animator> ();
     FPCamControll = GetComponent <CameraController> ();
     arrowControll = referances.Arrow.GetComponent <ArrowController> ();
     moveSpeed     = player.stats.walkSpeed;
     GoToTPMode();
     FPModeActive = false;
 }
Example #27
0
 // Start is called before the first frame update
 void Start()
 {
     for (int i = 0; i < startingArrows; i++)
     {
         ArrowController newArrow = Instantiate(arrow, firePoint.position, firePoint.rotation);
         newArrow.transform.SetParent(transform);
         newArrow.gameObject.SetActive(false);
         newArrow.name = this.name + "_Arrow_" + i;
         inactiveArrows.Push(newArrow);
     }
 }
Example #28
0
    public void Recycle()
    {
        gameObject.SetActive(false);

        ArrowController arrow = ArrowController.Instance;

        if (arrow.circle == this)
        {
            arrow.ArrowState = ArrowController.State.DEAD;
        }
    }
Example #29
0
    void shootArrow()
    {
        ArrowController arrowCont = arrows[0].GetComponent <ArrowController> ();
        Vector3         arrowVelo = new Vector3(-((direction.x / 2) * power), -((direction.y / 2) * power), 0);

        arrowCont.velocity      = arrowVelo;
        arrowCont.firedAngle    = transform.rotation.eulerAngles;
        arrowCont.isShot        = true;
        arrowCont.collider      = arrow.GetComponent <BoxCollider2D> ();
        arrowCont.collisionMask = 1 << 9;
    }
Example #30
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
 }
    private void spawnArrow(Vector3 position)
    {
        GameObject newArrow = Instantiate(arrowPrefab);

        newArrow.transform.position = position;
        ArrowController newArrowController = newArrow.GetComponent <ArrowController> ();

        newArrowController.arrow = chart.Arrows [arrowCounter];
        newArrowController.speed = chart.Bpm * chart.Arrows [arrowCounter].SpeedScale;
        arrows.Add(newArrow);
        ++arrowCounter;
    }
    void Awake() {
        acScript = GameObject.FindGameObjectWithTag("Arrow").GetComponent<ArrowController>();

        texture = transform.Find ("Texture");
		foodSpawn = GameObject.FindGameObjectWithTag("GameController").GetComponent<foodSpawner>();
		texture = transform.Find("Texture").transform;
		theBox.enabled = true;
		sr = texture.GetComponent<SpriteRenderer> ();

//		if (type == foodType.COW) {
//			texture.transform.localScale += new Vector3 (0.3f, 0.3f, 0.0f);
//		}

		//origTextScale = texture.localScale;
	}
	void Awake() {
        acScript = GameObject.FindGameObjectWithTag("Arrow").GetComponent<ArrowController>();

		current = this;
		specialPositions = new List<Vector3>();
		regularPositions = new List<Vector3>();
		//specialTiles = new GameObject[20];
		//regularTiles = new GameObject[500];

		basicFood = Resources.Load ("Food");
		foodPool = new Stack<GameObject> ();
		for (int i = 0; i < maxFood; ++i) {
			returnFood((GameObject)Instantiate(basicFood));
			++spawnedFood; //compensate for returnFood
		}

		specialPositions = new List<Vector3> ();
		regularPositions = new List<Vector3> ();

		//grab tile objects
		specialTiles = GameObject.FindGameObjectsWithTag("specialFoodSpot");
		//Debug.Log ("specialTiles size " + specialTiles.Length);
		regularTiles = GameObject.FindGameObjectsWithTag ("foodSpot");
		//Debug.Log ("regularTiles size " + regularTiles.Length);


		//add tranforms to lists
		for (int i = 0; i < specialTiles.Length; ++i) {
			specialPositions.Add (specialTiles [i].transform.position);
		}
		//Debug.Log ("SpecialTransforms size " + specialPositions.Count);

		for (int i = 0; i < regularTiles.Length; ++i) {
			regularPositions.Add (regularTiles [i].transform.position);
			//Debug.Log (regularTiles [i].transform.position);
		}
		//Debug.Log ("regularPositions size " + regularPositions.Count);

	}
 void Awake()
 {
     player = GetComponent<Player> ();
     navAgent = GetComponent<NavMeshAgent> ();
     playerAnim = GetComponent<Animator> ();
     FPCamControll = GetComponent<CameraController> ();
     arrowControll = referances.Arrow.GetComponent<ArrowController> ();
     moveSpeed = player.stats.walkSpeed;
     GoToTPMode ();
     FPModeActive = false;
 }
    void Awake()
    {
        body = GetComponent<Rigidbody>();
        cam = transform.Find("Camera").gameObject.GetComponent<Camera>();
        model = transform.Find("Model");
        modelRot = model.localRotation;
        armature = transform.Find("Model/Armature/spine").gameObject.GetComponentsInChildren<Transform>();
        armatureBase = transform.Find("Model/Armature");
        armatureRots = new Quaternion[armature.Length];
        for (int i = 1; i < armature.Length; i++)
        {
            armatureRots[i] = armature[i].rotation;
        }

        inkFX = transform.Find("Model/InkFX").gameObject.GetComponent<ParticleSystem>();
        boostFX = transform.Find("Model/BoostFX").gameObject.GetComponent<ParticleSystem>();
        superBoostFX = transform.Find("Model/SuperBoostFX").gameObject.GetComponent<ParticleSystem>();
        trailFX = transform.Find("Model/Trail").gameObject.GetComponent<TrailRenderer>();
        engineSound = GetComponent<AudioSource>();
        arrow = transform.Find("Arrow").gameObject.GetComponent<ArrowController>();
        game = transform.parent.parent.gameObject.GetComponent<GameController>();
        otherSquid = transform.parent.GetChild(1-playerIndex).gameObject;
    }