net.mwplay.cocostudio.ui.particleutil.Particle.java Source code

Java tutorial

Introduction

Here is the source code for net.mwplay.cocostudio.ui.particleutil.Particle.java

Source

/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.mwplay.cocostudio.ui.particleutil;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Pool.Poolable;

//??
public class Particle implements Poolable {
    public class ModeGravity { //??
        public Vector2 dir = new Vector2(); //??
        public float radialAccel; //?
        public float tangentialAccel; //?

        public void reset() {
            this.dir.setZero();
            this.radialAccel = 0;
            this.tangentialAccel = 0;
        }
    }

    public class ModeRadius {//?
        public float angle; //??
        public float degreesPerSecond; //
        public float radius; //?
        public float deltaRadius; //?

        public void reset() {
            this.angle = 0;
            this.degreesPerSecond = 0;
            this.radius = 0;
            this.deltaRadius = 0;
        }
    }

    public Vector2 pos = new Vector2(); //?
    public Vector2 startPos = new Vector2(); //??
    public Color color = new Color(); //
    public Color deltaColor = new Color(); //
    public float size; //?
    public float deltaSize; //?
    public float rotation; //
    public float deltaRotation; //
    public float timeToLive; //
    public ModeGravity modeA = new ModeGravity();
    public ModeRadius modeB = new ModeRadius();

    @Override
    public void reset() {
        this.pos.setZero();
        this.startPos.setZero();
        this.color.set(Color.CLEAR);
        this.deltaColor.set(Color.CLEAR);
        this.size = 0;
        this.deltaSize = 0;
        this.deltaRotation = 0;
        this.timeToLive = 0;
        modeA.reset();
        modeB.reset();

    }
}