コード例 #1
0
 public override void Awake()
 {
     base.Awake();
     sliderHealth        = this.GetComponentInChildren <Slider>();
     _pathfindingManager = FindObjectOfType <Pathfinding.PathfindingManager>();
     _bloodController    = FindObjectOfType <BloodController>();
 }
コード例 #2
0
    void Start()
    {
        _bloodController = FindObjectOfType <BloodController>();
        _rb           = GetComponent <Rigidbody>();
        _cam          = FindObjectOfType <CameraController>();
        PersonalBlood = 1.0f;

        _splash = transform.Find("SplashingAround").gameObject;
        _anim   = GetComponentInChildren <Animator>();
    }
コード例 #3
0
    //Take damage
    void OnTriggerStay2D(Collider2D col)
    {
        if (isDead && col.gameObject.CompareTag("Wall") && !bounced)
        {
            if (rb.velocity.x != 0 || rb.velocity.y != 0)
            {
                Vector2 norm = (player.transform.position - this.transform.position).normalized;
                rb.velocity = norm * 75f * Time.deltaTime;
                bounced     = true;
            }
        }
        if (col.gameObject.CompareTag("Walkable"))
        {
            fieldToWalkOn = col.gameObject;
        }
        if (col.gameObject.CompareTag("Player"))
        {
            PlayerMovement playermovement = col.gameObject.GetComponent <PlayerMovement>();

            if (playermovement.isDashing && !hit && playermovement.animationTimer <= 1 && !isDead)
            {
                Vector2 norm = (player.transform.position - this.transform.position).normalized;
                rb.velocity = -norm * 50f * player.GetComponent <PlayerMovement>().damage *Time.deltaTime;
                for (int i = 0; i < 25; i++)
                {
                    BloodController b = Instantiate(bloodPrefab).GetComponent <BloodController>();
                    b.transform.position = this.transform.position;
                    b.dir   = Random.Range(0, 360);
                    b.speed = Random.Range(0.5f, 1);
                }
                //rb.velocity = -transform.forward * 1000f;
                //Time.timeScale = 0.25f;
                hit = true;
                Camera.main.GetComponent <MainCamera>().screenshake();
                StartCoroutine(flash());
                Instantiate(blood).transform.position = this.transform.position;
                health--;
                if (health <= 0)
                {
                    kill();
                }
            }
        }
    }
コード例 #4
0
    void Start()
    {
        controllManager.container.jumpDelayAfterInterval  = 0;
        controllManager.container.jumpDelayBeforeInterval = 0;
        controllManager.container.dashSpeed = 4.2f;
        bloodController = GameObject.FindObjectOfType <BloodController>();
        controllManager.container.posBeforeJump = transform.position;

        animManager                      = new AnimationData.AnimationManager(gameObject, controllManager);
        animManagerWithBlood             = new AnimManagerWithBlood(animManager, bloodController.bloodManager);
        controllManager.container.isRoll = Input.GetKeyDown(KeyCode.LeftShift);
        controllManager.container.stats  = stats;
        // neckerchiefManager = new ControllDATA.NeckerchiefManager(gameObject, sharf);
        weaponManager = new FightDATA.WeaponManager(gameObject);
        weaponManager.current.UseWeaponFromPrefab(weaponStats);

        animManager.OnAttack += (args) =>
        {
            weaponManager.current.Strike(args);
        };
    }
コード例 #5
0
    public BloodAnimation(BloodController control)
    {
        controller = control;
//		if(controller.rifting)
//			splash = Random.value > 0.5;
        speed = controller.cellSpeed * Random.Range(0.8f, 1f);
        GameObject c = GameObject.Instantiate(controller.cell);

        c.transform.localPosition = controller.GetRandomPoint(controller.paths [0]);
        c.transform.localScale    = Vector3.one * controller.cellScale;
        //cells.Add (c);
        path = new List <Vector3> ();
        for (int i = 1; i < controller.paths.Count; i++)
        {
            path.Add(controller.GetRandomPoint(controller.paths[i]));
        }
        cell = c;
        cell.transform.SetParent(controller.cellsContainer.transform, false);

        if (controller.path1s != null && controller.path1s.Count != null)
        {
            float             rand     = Random.value;
            List <GameObject> nextPath = rand > 0.5 ? controller.path1s : controller.path2s;
            for (int i = 0; i < nextPath.Count; i++)
            {
                path.Add(controller.GetRandomPoint(nextPath [i]));
            }
        }

//		if (splash) {
//			force =  (controller.rift.transform.forward +  new Vector3(Random.value, Random.value * 3, Random.value )* .8f) * speed;
//			path.RemoveRange (2, path.Count - 2);
//			path.Add (controller.GetRandomPoint(controller.rift));
//		}
        //destinations.Add (path);
    }
コード例 #6
0
 private void Awake()
 {
     _levelController = FindObjectOfType <LevelController>();
     _bloodController = FindObjectOfType <BloodController>();
 }